Examples of ExprNodeEvaluator


Examples of org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator

    try {
      StructObjectInspector rowObjectInspector = (StructObjectInspector)this.tab.getDeserializer().getObjectInspector();
      Object[] rowWithPart = new Object[2];
      InspectableObject inspectableObject = new InspectableObject();
    
      ExprNodeEvaluator evaluator = null;
      if (this.prunerExpr != null)
        evaluator = ExprNodeEvaluatorFactory.get(this.prunerExpr);
      for(Partition part: Hive.get().getPartitions(this.tab)) {
        // Set all the variables here
        LinkedHashMap<String, String> partSpec = part.getSpec();

        // Create the row object
        ArrayList<String> partNames = new ArrayList<String>();
        ArrayList<String> partValues = new ArrayList<String>();
        ArrayList<ObjectInspector> partObjectInspectors = new ArrayList<ObjectInspector>();
        for(Map.Entry<String,String>entry : partSpec.entrySet()) {
          partNames.add(entry.getKey());
          partValues.add(entry.getValue());
          partObjectInspectors.add(ObjectInspectorFactory.getStandardPrimitiveObjectInspector(String.class));
        }
        StructObjectInspector partObjectInspector = ObjectInspectorFactory.getStandardStructObjectInspector(partNames, partObjectInspectors);
       
        rowWithPart[1] = partValues;
        ArrayList<StructObjectInspector> ois = new ArrayList<StructObjectInspector>(2);
        ois.add(rowObjectInspector);
        ois.add(partObjectInspector);
        StructObjectInspector rowWithPartObjectInspector = ObjectInspectorFactory.getUnionStructObjectInspector(ois);
       
        // evaluate the expression tree
        if (evaluator != null) {
          evaluator.evaluate(rowWithPart, rowWithPartObjectInspector, inspectableObject);
          LOG.trace("prune result for partition " + partSpec + ": " + inspectableObject.o);
          if (Boolean.TRUE.equals(inspectableObject.o)) {
            LOG.debug("retained partition: " + partSpec);
            true_parts.add(part);
          }
View Full Code Here

Examples of org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator

      throws HiveException {
    PTFExpressionDef argDef = new PTFExpressionDef();

    ExprNodeDesc exprNode = semAly.genExprNodeDesc(arg, inpShape.getRr(),
        inpShape.getTypeCheckCtx());
    ExprNodeEvaluator exprEval = WindowingExprNodeEvaluatorFactory.get(llInfo, exprNode);
    ObjectInspector oi = initExprNodeEvaluator(exprEval, exprNode, inpShape);

    argDef.setExpressionTreeString(arg.toStringTree());
    argDef.setExprNode(exprNode);
    argDef.setExprEvaluator(exprEval);
View Full Code Here

Examples of org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator

    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);
      }
    }
View Full Code Here

Examples of org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator

            }
          }

          // evaluate the expression tree
          if (prunerExpr != null) {
            ExprNodeEvaluator evaluator = ExprNodeEvaluatorFactory.get(prunerExpr);
            ObjectInspector evaluateResultOI = evaluator.initialize(rowWithPartObjectInspector);
            Object evaluateResultO = evaluator.evaluate(rowWithPart);
            Boolean r = (Boolean) ((PrimitiveObjectInspector)evaluateResultOI).getPrimitiveJavaObject(evaluateResultO);
            LOG.trace("prune result for partition " + partSpec + ": " + r);
            if (Boolean.FALSE.equals(r)) {
              if (denied_parts.isEmpty()) {
                Partition part = Hive.get().getPartition(tab, partSpec, Boolean.FALSE);
View Full Code Here

Examples of org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator

            }
          }
         
          // evaluate the expression tree
          if (prunerExpr != null) {
            ExprNodeEvaluator evaluator = ExprNodeEvaluatorFactory.get(prunerExpr);
            ObjectInspector evaluateResultOI = evaluator.initialize(rowWithPartObjectInspector);
            Object evaluateResultO = evaluator.evaluate(rowWithPart);
            Boolean r = (Boolean) ((PrimitiveObjectInspector)evaluateResultOI).getPrimitiveJavaObject(evaluateResultO);
            LOG.trace("prune result for partition " + partSpec + ": " + r);
            if (Boolean.FALSE.equals(r)) {
              if (denied_parts.isEmpty()) {
                Partition part = Hive.get().getPartition(tab, partSpec, Boolean.FALSE);
View Full Code Here

Examples of org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator

    ois.add(rowObjectInspector);
    ois.add(partObjectInspector);
    StructObjectInspector rowWithPartObjectInspector = ObjectInspectorFactory
        .getUnionStructObjectInspector(ois);

    ExprNodeEvaluator evaluator = ExprNodeEvaluatorFactory
        .get(expr);
    ObjectInspector evaluateResultOI = evaluator
        .initialize(rowWithPartObjectInspector);
    Object evaluateResultO = evaluator.evaluate(rowWithPart);

    return ((PrimitiveObjectInspector) evaluateResultOI)
        .getPrimitiveJavaObject(evaluateResultO);
  }
View Full Code Here

Examples of org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator

    ois.add(rowObjectInspector);
    ois.add(partObjectInspector);
    StructObjectInspector rowWithPartObjectInspector =
      ObjectInspectorFactory.getUnionStructObjectInspector(ois);

    ExprNodeEvaluator evaluator = ExprNodeEvaluatorFactory.get(expr);
    ObjectInspector evaluateResultOI = evaluator.initialize(rowWithPartObjectInspector);

    Map<PrimitiveObjectInspector, ExprNodeEvaluator> result =
      new HashMap<PrimitiveObjectInspector, ExprNodeEvaluator>();
    result.put((PrimitiveObjectInspector)evaluateResultOI,  evaluator);
    return result;
View Full Code Here

Examples of org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator

      throws HiveException {
    assert(pair.size() > 0);
    // only get the 1st entry from the map
    Map.Entry<PrimitiveObjectInspector, ExprNodeEvaluator> entry = pair.entrySet().iterator().next();
    PrimitiveObjectInspector evaluateResultOI = entry.getKey();
    ExprNodeEvaluator evaluator = entry.getValue();

    Object evaluateResultO = evaluator.evaluate(rowWithPart);

    return evaluateResultOI.getPrimitiveJavaObject(evaluateResultO);
  }
View Full Code Here

Examples of org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator

    try {
      StructObjectInspector rowObjectInspector = (StructObjectInspector)this.tab.getDeserializer().getObjectInspector();
      Object[] rowWithPart = new Object[2];
      InspectableObject inspectableObject = new InspectableObject();
    
      ExprNodeEvaluator evaluator = null;
      if (this.prunerExpr != null)
        evaluator = ExprNodeEvaluatorFactory.get(this.prunerExpr);
      for(Partition part: Hive.get().getPartitions(this.tab)) {
        // Set all the variables here
        LinkedHashMap<String, String> partSpec = part.getSpec();

        // Create the row object
        ArrayList<String> partNames = new ArrayList<String>();
        ArrayList<String> partValues = new ArrayList<String>();
        ArrayList<ObjectInspector> partObjectInspectors = new ArrayList<ObjectInspector>();
        for(Map.Entry<String,String>entry : partSpec.entrySet()) {
          partNames.add(entry.getKey());
          partValues.add(entry.getValue());
          partObjectInspectors.add(ObjectInspectorFactory.getStandardPrimitiveObjectInspector(String.class));
        }
        StructObjectInspector partObjectInspector = ObjectInspectorFactory.getStandardStructObjectInspector(partNames, partObjectInspectors);
       
        rowWithPart[1] = partValues;
        ArrayList<StructObjectInspector> ois = new ArrayList<StructObjectInspector>(2);
        ois.add(rowObjectInspector);
        ois.add(partObjectInspector);
        StructObjectInspector rowWithPartObjectInspector = ObjectInspectorFactory.getUnionStructObjectInspector(ois);
       
        // evaluate the expression tree
        if (evaluator != null) {
          evaluator.evaluate(rowWithPart, rowWithPartObjectInspector, inspectableObject);
          LOG.trace("prune result for partition " + partSpec + ": " + inspectableObject.o);
          if (!Boolean.FALSE.equals(inspectableObject.o)) {
            LOG.debug("retained partition: " + partSpec);
            ret_parts.add(part);
          } else {
View Full Code Here

Examples of org.apache.hadoop.hive.ql.exec.ExprNodeEvaluator

            continue;
          }
        }
        return null;
      }
      ExprNodeEvaluator evaluator = ExprNodeEvaluatorFactory.get(func);
      ObjectInspector output = evaluator.initialize(null);

      Object constant = evaluator.evaluate(null);
      Object java = ObjectInspectorUtils.copyToStandardJavaObject(constant, output);

      return new ExprNodeConstantDesc(java);
    } catch (Exception e) {
      return null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.