示例#1
0
  private ObjectInspector initExprNodeEvaluator(
      ExprNodeEvaluator exprEval, ExprNodeDesc exprNode, ShapeDetails inpShape)
      throws HiveException {
    ObjectInspector outOI;
    outOI = exprEval.initialize(inpShape.getOI());

    /*
     * if there are any LeadLag functions in this Expression Tree: - setup a
     * duplicate Evaluator for the 1st arg of the LLFuncDesc - initialize it
     * using the InputInfo provided for this Expr tree - set the duplicate
     * evaluator on the LLUDF instance.
     */
    List<ExprNodeGenericFuncDesc> llFuncExprs = llInfo.getLLFuncExprsInTopExpr(exprNode);
    if (llFuncExprs != null) {
      for (ExprNodeGenericFuncDesc llFuncExpr : llFuncExprs) {
        ExprNodeDesc firstArg = llFuncExpr.getChildren().get(0);
        ExprNodeEvaluator dupExprEval = WindowingExprNodeEvaluatorFactory.get(llInfo, firstArg);
        dupExprEval.initialize(inpShape.getOI());
        GenericUDFLeadLag llFn = (GenericUDFLeadLag) llFuncExpr.getGenericUDF();
        llFn.setExprEvaluator(dupExprEval);
      }
    }

    return outOI;
  }
示例#2
0
 private static void addInputColumnsToList(
     ShapeDetails shape, ArrayList<String> fieldNames, ArrayList<ObjectInspector> fieldOIs) {
   StructObjectInspector OI = shape.getOI();
   for (StructField f : OI.getAllStructFieldRefs()) {
     fieldNames.add(f.getFieldName());
     fieldOIs.add(f.getFieldObjectInspector());
   }
 }
示例#3
0
 protected void initialize(ShapeDetails shp, StructObjectInspector OI) throws HiveException {
   String serdeClassName = shp.getSerdeClassName();
   Properties serDeProps = new Properties();
   Map<String, String> serdePropsMap = new LinkedHashMap<String, String>();
   addOIPropertiestoSerDePropsMap(OI, serdePropsMap);
   for (String serdeName : serdePropsMap.keySet()) {
     serDeProps.setProperty(serdeName, serdePropsMap.get(serdeName));
   }
   try {
     SerDe serDe = (SerDe) SerDeUtils.lookupDeserializer(serdeClassName);
     serDe.initialize(hConf, serDeProps);
     shp.setSerde(serDe);
     shp.setOI((StructObjectInspector) serDe.getObjectInspector());
   } catch (SerDeException se) {
     throw new HiveException(se);
   }
 }