hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "navanee (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HIVE-7132) Hive 0.11.0 Custom UDTF doesnt call close method
Date Wed, 28 May 2014 07:19:02 GMT
navanee created HIVE-7132:
-----------------------------

             Summary: Hive 0.11.0 Custom UDTF doesnt call close method
                 Key: HIVE-7132
                 URL: https://issues.apache.org/jira/browse/HIVE-7132
             Project: Hive
          Issue Type: Bug
          Components: Query Processor
    Affects Versions: 0.11.0
         Environment: shark 0.9.1,hive 0.11.0
            Reporter: navanee


In My Custom UDTF, Process method collects all row info and store them in array list, 
and in close method, i will try to forward the array list.

But some how ,my close method didnt get called while executing custom UDTF, getting empty
as result.

private PrimitiveObjectInspector[] inputOIs; // input ObjectInspectors
private List<Set<Object>> distincts = new ArrayList<Set<Object>>();

 @Override
  public void process(Object[] arg0) throws HiveException {
    for (int i = 0; i < arg0.length; i++) {
        String value =  inputOIs[i].getPrimitiveJavaObject(arg0[i]).toString();
        distincts.get(i).add(value);
   }
}

@Override
  public void close() throws HiveException {
     forward(new Object[]{distincts});
 }

  @Override
  public StructObjectInspector initialize(ObjectInspector[] arg0) throws UDFArgumentException
{
    inputOIs=new PrimitiveObjectInspector[arg0.length]; 
    List<String> _fields = new ArrayList<String>();
    List<ObjectInspector> fieldOIs = new ArrayList<ObjectInspector>();
  for (int i = 0; i < arg0.length; i++) {
      inputOIs[i]=(PrimitiveObjectInspector) arg0[i];
      distincts.add(new HashSet<Object>());
      _fields.add(new Integer(i).toString());
        fieldOIs.add(PrimitiveObjectInspectorFactory.javaStringObjectInspector);
    }
    return ObjectInspectorFactory.getStandardStructObjectInspector(_fields, fieldOIs);

  }

I tried the same code in hive 0.12, its working perfectly. But i am using shark 0.9.1, supports
only hive 0.11.

Please help me on the issue




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message