static long getTimestampVal(IndexSearchCondition sc) throws IOException { long timestamp; try { ExprNodeConstantEvaluator eval = new ExprNodeConstantEvaluator(sc.getConstantDesc()); ObjectInspector inspector = eval.initialize(null); Object value = eval.evaluate(null); if (inspector instanceof LongObjectInspector) { timestamp = ((LongObjectInspector) inspector).get(value); } else { PrimitiveObjectInspector primitive = (PrimitiveObjectInspector) inspector; timestamp = PrimitiveObjectInspectorUtils.getTimestamp(value, primitive).toEpochMilli(); } } catch (HiveException e) { throw new IOException(e); } return timestamp; }
public PushdownTuple(IndexSearchCondition sc, PrimitiveComparison pCompare, CompareOp cOpt) throws SerDeException { ExprNodeConstantEvaluator eval = new ExprNodeConstantEvaluator(sc.getConstantDesc()); try { this.pCompare = pCompare; this.cOpt = cOpt; Writable writable = (Writable) eval.evaluate(null); constVal = getConstantAsBytes(writable); } catch (ClassCastException cce) { log.info(StringUtils.stringifyException(cce)); throw new SerDeException(" Column type mismatch in where clause " + sc.getComparisonExpr().getExprString() + " found type " + sc.getConstantDesc().getTypeString() + " instead of " + sc.getColumnDesc().getTypeString()); } catch (HiveException e) { throw new SerDeException(e); } }
public static ExprNodeEvaluator get(ExprNodeDesc desc, Configuration conf) throws HiveException { // Constant node if (desc instanceof ExprNodeConstantDesc) { return new ExprNodeConstantEvaluator((ExprNodeConstantDesc) desc, conf); } // Column-reference node, e.g. a column in the input row if (desc instanceof ExprNodeColumnDesc) { return new ExprNodeColumnEvaluator((ExprNodeColumnDesc) desc, conf); } // Generic Function node, e.g. CASE, an operator or a UDF node if (desc instanceof ExprNodeGenericFuncDesc) { return new ExprNodeGenericFuncEvaluator((ExprNodeGenericFuncDesc) desc, conf); } // Field node, e.g. get a.myfield1 from a if (desc instanceof ExprNodeFieldDesc) { return new ExprNodeFieldEvaluator((ExprNodeFieldDesc) desc, conf); } // Dynamic value which will be determined during query runtime if (desc instanceof ExprNodeDynamicValueDesc) { return new ExprNodeDynamicValueEvaluator((ExprNodeDynamicValueDesc) desc, conf); } throw new RuntimeException( "Cannot find ExprNodeEvaluator for the exprNodeDesc = " + desc); }
public PushdownTuple(IndexSearchCondition sc, PrimitiveComparison pCompare, CompareOp cOpt) throws SerDeException { ExprNodeConstantEvaluator eval = new ExprNodeConstantEvaluator(sc.getConstantDesc()); try { this.pCompare = pCompare; this.cOpt = cOpt; Writable writable = (Writable) eval.evaluate(null); constVal = getConstantAsBytes(writable); } catch (ClassCastException cce) { log.info(StringUtils.stringifyException(cce)); throw new SerDeException(" Column type mismatch in where clause " + sc.getIndexExpr().getExprString() + " found type " + sc.getConstantDesc().getTypeString() + " instead of " + sc.getColumnDesc().getTypeString()); } catch (HiveException e) { throw new SerDeException(e); } }
public static ExprNodeEvaluator get(ExprNodeDesc desc, Configuration conf) throws HiveException { // Constant node if (desc instanceof ExprNodeConstantDesc) { return new ExprNodeConstantEvaluator((ExprNodeConstantDesc) desc, conf); } // Column-reference node, e.g. a column in the input row if (desc instanceof ExprNodeColumnDesc) { return new ExprNodeColumnEvaluator((ExprNodeColumnDesc) desc, conf); } // Generic Function node, e.g. CASE, an operator or a UDF node if (desc instanceof ExprNodeGenericFuncDesc) { return new ExprNodeGenericFuncEvaluator((ExprNodeGenericFuncDesc) desc, conf); } // Field node, e.g. get a.myfield1 from a if (desc instanceof ExprNodeFieldDesc) { return new ExprNodeFieldEvaluator((ExprNodeFieldDesc) desc, conf); } // Dynamic value which will be determined during query runtime if (desc instanceof ExprNodeDynamicValueDesc) { return new ExprNodeDynamicValueEvaluator((ExprNodeDynamicValueDesc) desc, conf); } throw new RuntimeException( "Cannot find ExprNodeEvaluator for the exprNodeDesc = " + desc); }
for (IndexSearchCondition sc : conditions) { ExprNodeConstantEvaluator eval = new ExprNodeConstantEvaluator(sc.getConstantDesc()); PrimitiveObjectInspector objInspector; Object writable; objInspector = (PrimitiveObjectInspector) eval.initialize(null); writable = eval.evaluate(null); } catch (ClassCastException cce) { throw new IOException("Currently only primitve types are supported. Found: "
public static ExprNodeEvaluator get(ExprNodeDesc desc) throws HiveException { // Constant node if (desc instanceof ExprNodeConstantDesc) { return new ExprNodeConstantEvaluator((ExprNodeConstantDesc) desc); } // Column-reference node, e.g. a column in the input row if (desc instanceof ExprNodeColumnDesc) { return new ExprNodeColumnEvaluator((ExprNodeColumnDesc) desc); } // Generic Function node, e.g. CASE, an operator or a UDF node if (desc instanceof ExprNodeGenericFuncDesc) { return new ExprNodeGenericFuncEvaluator((ExprNodeGenericFuncDesc) desc); } // Field node, e.g. get a.myfield1 from a if (desc instanceof ExprNodeFieldDesc) { return new ExprNodeFieldEvaluator((ExprNodeFieldDesc) desc); } throw new RuntimeException( "Cannot find ExprNodeEvaluator for the exprNodeDesc = " + desc); }
private long getTimestampVal(IndexSearchCondition sc) throws IOException { long timestamp; try { ExprNodeConstantEvaluator eval = new ExprNodeConstantEvaluator(sc.getConstantDesc()); ObjectInspector inspector = eval.initialize(null); Object value = eval.evaluate(null); if (inspector instanceof LongObjectInspector) { timestamp = ((LongObjectInspector)inspector).get(value); } else { PrimitiveObjectInspector primitive = (PrimitiveObjectInspector) inspector; timestamp = PrimitiveObjectInspectorUtils.getTimestamp(value, primitive).getTime(); } } catch (HiveException e) { throw new IOException(e); } return timestamp; }
public static ExprNodeEvaluator get(ExprNodeDesc desc) { // Constant node if (desc instanceof ExprNodeConstantDesc) { return new ExprNodeConstantEvaluator((ExprNodeConstantDesc) desc); } // Column-reference node, e.g. a column in the input row if (desc instanceof ExprNodeColumnDesc) { return new ExprNodeColumnEvaluator((ExprNodeColumnDesc) desc); } // Generic Function node, e.g. CASE, an operator or a UDF node if (desc instanceof ExprNodeGenericFuncDesc) { return new ExprNodeGenericFuncEvaluator((ExprNodeGenericFuncDesc) desc); } // Field node, e.g. get a.myfield1 from a if (desc instanceof ExprNodeFieldDesc) { return new ExprNodeFieldEvaluator((ExprNodeFieldDesc) desc); } // Null node, a constant node with value NULL and no type information if (desc instanceof ExprNodeNullDesc) { return new ExprNodeNullEvaluator((ExprNodeNullDesc) desc); } throw new RuntimeException( "Cannot find ExprNodeEvaluator for the exprNodeDesc = " + desc); } }
for (IndexSearchCondition sc : conditions) { ExprNodeConstantEvaluator eval = new ExprNodeConstantEvaluator(sc.getConstantDesc()); PrimitiveObjectInspector objInspector; Object writable; objInspector = (PrimitiveObjectInspector)eval.initialize(null); writable = eval.evaluate(null); } catch (ClassCastException cce) { throw new IOException("Currently only primitve types are supported. Found: " +
for (IndexSearchCondition sc : searchConditions){ ExprNodeConstantEvaluator eval = new ExprNodeConstantEvaluator(sc.getConstantDesc()); PrimitiveObjectInspector objInspector; Object writable; objInspector = (PrimitiveObjectInspector)eval.initialize(null); writable = eval.evaluate(null); } catch (ClassCastException cce) { throw new IOException("Currently only primitve types are supported. Found: " +