Review Board 1.7.22


HIVE-4774 Hive Runtime Error while closing operators: java.lang.NullPointerException

Review Request #12132 - Created June 27, 2013 and submitted

Remus Rusanu
vectorization
HIVE-4774
Reviewers
hive
jitendra
hive-git
Turns out the nodeDesc.getWritableObjectInspector() can return null. USe the TypeInfo to derive an object inspector in such case.
Manually run repro case.
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/VectorExpressionWriterFactory.java
Revision b041fc5 New Change
[20] 36 lines
[+20]
37
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory;
37
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory;
38
import org.apache.hadoop.hive.serde2.objectinspector.StructField;
38
import org.apache.hadoop.hive.serde2.objectinspector.StructField;
39
import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
39
import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
40
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
40
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
41
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
41
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;

    
   
42
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoUtils;
42
import org.apache.hadoop.io.BooleanWritable;
43
import org.apache.hadoop.io.BooleanWritable;
43
import org.apache.hadoop.io.FloatWritable;
44
import org.apache.hadoop.io.FloatWritable;
44
import org.apache.hadoop.io.IntWritable;
45
import org.apache.hadoop.io.IntWritable;
45
import org.apache.hadoop.io.LongWritable;
46
import org.apache.hadoop.io.LongWritable;
46
import org.apache.hadoop.io.Text;
47
import org.apache.hadoop.io.Text;
[+20] [20] 18 lines
[+20]
65
    public ObjectInspector getObjectInspector() {
66
    public ObjectInspector getObjectInspector() {
66
      return objectInspector;
67
      return objectInspector;
67
    }
68
    }
68

    
   
69

   
69
    public VectorExpressionWriter init(ExprNodeDesc nodeDesc) throws HiveException {
70
    public VectorExpressionWriter init(ExprNodeDesc nodeDesc) throws HiveException {
70
      this.objectInspector = nodeDesc.getWritableObjectInspector();
71
      objectInspector = nodeDesc.getWritableObjectInspector();

    
   
72
      if (null == objectInspector) {

    
   
73
        objectInspector = TypeInfoUtils

    
   
74
            .getStandardWritableObjectInspectorFromTypeInfo(nodeDesc.getTypeInfo());

    
   
75
      }

    
   
76
      if (null == objectInspector) {

    
   
77
        throw new HiveException(String.format(

    
   
78
            "Failed to initialize VectorExpressionWriter for expr: %s", 

    
   
79
            nodeDesc.getExprString()));

    
   
80
      }
71
      return this;
81
      return this;
72
    }
82
    }
73

    
   
83

   
74
    /**
84
    /**
75
     * The base implementation must be overridden by the Long specialization
85
     * The base implementation must be overridden by the Long specialization
[+20] [20] 351 lines
  1. ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/VectorExpressionWriterFactory.java: Loading...