Package org.apache.hadoop.hive.ql.plan

Examples of org.apache.hadoop.hive.ql.plan.exprNodeConstantDesc


  private exprNodeDesc genSamplePredicate(TableSample ts, List<String> bucketCols,
                                      boolean useBucketCols, String alias,
                                      RowResolver rwsch, QBMetaData qbm, exprNodeDesc planExpr)
    throws SemanticException {

    exprNodeDesc numeratorExpr = new exprNodeConstantDesc(
        TypeInfoFactory.intTypeInfo,
        Integer.valueOf(ts.getNumerator() - 1));

    exprNodeDesc denominatorExpr = new exprNodeConstantDesc(
        TypeInfoFactory.intTypeInfo,
        Integer.valueOf(ts.getDenominator()));

    exprNodeDesc intMaxExpr = new exprNodeConstantDesc(
        TypeInfoFactory.intTypeInfo,
        Integer.valueOf(Integer.MAX_VALUE));

    ArrayList<exprNodeDesc> args = new ArrayList<exprNodeDesc>();
    if (planExpr != null)
View Full Code Here


            int freq = conf.getIntVar(HiveConf.ConfVars.HIVETESTMODESAMPLEFREQ);
            TableSample tsSample = new TableSample(1, freq);
            tsSample.setInputPruning(false);
            qb.getParseInfo().setTabSample(alias, tsSample);
            LOG.info("Need sample filter");
            exprNodeDesc randFunc = TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc("rand", new exprNodeConstantDesc(Integer.valueOf(460476415)));
            exprNodeDesc samplePred = genSamplePredicate(tsSample, null, false, alias, rwsch, qb.getMetaData(), randFunc);
            tableOp = OperatorFactory.getAndMakeChild(new filterDesc(samplePred, true), top);
          }
        }
      }
View Full Code Here

      throw e;
    }
  }

  private static exprNodeDesc getListIndexNode(exprNodeDesc node, int index) {
    return getListIndexNode(node, new exprNodeConstantDesc(index));
  }
View Full Code Here

      int basetimes = 100000;
      measureSpeed("1 + 2",
          basetimes * 100,
          ExprNodeEvaluatorFactory.get(
              TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc("+",
                  new exprNodeConstantDesc(1),
                  new exprNodeConstantDesc(2))),
          r,
          Integer.valueOf(1 + 2));
      measureSpeed("1 + 2 - 3",
          basetimes * 100,
          ExprNodeEvaluatorFactory.get(
              TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc("-",
                  TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc("+",
                      new exprNodeConstantDesc(1),
                      new exprNodeConstantDesc(2)),
                  new exprNodeConstantDesc(3))),
          r,
          Integer.valueOf(1 + 2 - 3));
      measureSpeed("1 + 2 - 3 + 4",
          basetimes * 100,
          ExprNodeEvaluatorFactory.get(
              TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc("+",
                  TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc("-",
                      TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc("+",
                          new exprNodeConstantDesc(1),
                          new exprNodeConstantDesc(2)),
                      new exprNodeConstantDesc(3)),
                  new exprNodeConstantDesc(4))),                     
          r,
          Integer.valueOf(1 + 2 - 3 + 4));
      measureSpeed("concat(\"1\", \"2\")",
          basetimes * 100,
          ExprNodeEvaluatorFactory.get(
              TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc("concat",
                  new exprNodeConstantDesc("1"),
                  new exprNodeConstantDesc("2"))),
          r,
          "12");
      measureSpeed("concat(concat(\"1\", \"2\"), \"3\")",
          basetimes * 100,
          ExprNodeEvaluatorFactory.get(
              TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc("concat",
                  TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc("concat",
                      new exprNodeConstantDesc("1"),
                      new exprNodeConstantDesc("2")),
                  new exprNodeConstantDesc("3"))),
          r,
          "123");
      measureSpeed("concat(concat(concat(\"1\", \"2\"), \"3\"), \"4\")",
          basetimes * 100,
          ExprNodeEvaluatorFactory.get(
              TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc("concat",
                TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc("concat",
                    TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc("concat",
                        new exprNodeConstantDesc("1"),
                        new exprNodeConstantDesc("2")),
                    new exprNodeConstantDesc("3")),
                new exprNodeConstantDesc("4"))),
          r,
          "1234");
      exprNodeDesc constant1 = new exprNodeConstantDesc(1);
      exprNodeDesc constant2 = new exprNodeConstantDesc(2);
      measureSpeed("concat(col1[1], cola[1])",
          basetimes * 10,
          ExprNodeEvaluatorFactory.get(
              TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc("concat",
                  getListIndexNode(new exprNodeColumnDesc(col1Type, "col1", "", false), constant1),
View Full Code Here

        TypeInfoFactory.doubleTypeInfo,
        FunctionRegistry.getFunctionInfo(Constants.DOUBLE_TYPE_NAME).getGenericUDF(),
        children1);
   
    ArrayList<exprNodeDesc> children2 = new ArrayList<exprNodeDesc>();
    children2.add(new exprNodeConstantDesc(TypeInfoFactory.longTypeInfo, Long.valueOf(100)));
    exprNodeDesc rhs = new exprNodeGenericFuncDesc(
        TypeInfoFactory.doubleTypeInfo,
        FunctionRegistry.getFunctionInfo(Constants.DOUBLE_TYPE_NAME).getGenericUDF(),
        children2);
   
View Full Code Here

    try {
      System.out.println("Testing Filter Operator");
      exprNodeDesc col0 = TestExecDriver.getStringColumn("col0");
      exprNodeDesc col1 = TestExecDriver.getStringColumn("col1");
      exprNodeDesc col2 = TestExecDriver.getStringColumn("col2");
      exprNodeDesc zero = new exprNodeConstantDesc("0");
      exprNodeDesc func1 = TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc(">", col2, col1);
      exprNodeDesc func2 = TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc("==", col0, zero);
      exprNodeDesc func3 = TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc("and", func1, func2);
      assert(func3 != null);
      filterDesc filterCtx = new filterDesc(func3, false);
View Full Code Here

      // col1
      exprNodeDesc exprDesc1 = TestExecDriver.getStringColumn("col1");

      // col2
      exprNodeDesc expr1 = TestExecDriver.getStringColumn("col0");
      exprNodeDesc expr2 = new exprNodeConstantDesc("1");
      exprNodeDesc exprDesc2 = TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc("concat", expr1, expr2);

      // select operator to project these two columns
      ArrayList<exprNodeDesc> earr = new ArrayList<exprNodeDesc> ();
      earr.add(exprDesc1);
View Full Code Here

      // col1
      exprNodeDesc exprDesc1 = TestExecDriver.getStringColumn("col1");

      // col2
      exprNodeDesc expr1 = TestExecDriver.getStringColumn("col0");
      exprNodeDesc expr2 = new exprNodeConstantDesc("1");
      exprNodeDesc exprDesc2 = TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc("concat", expr1, expr2);

      // select operator to project these two columns
      ArrayList<exprNodeDesc> earr = new ArrayList<exprNodeDesc> ();
      earr.add(exprDesc1);
View Full Code Here

        FunctionRegistry.getUDFClass(Constants.DOUBLE_TYPE_NAME),
        FunctionRegistry.getUDFMethod(Constants.DOUBLE_TYPE_NAME, TypeInfoFactory.stringTypeInfo),
        children1);
   
    ArrayList<exprNodeDesc> children2 = new ArrayList<exprNodeDesc>();
    children2.add(new exprNodeConstantDesc(TypeInfoFactory.longTypeInfo, Long.valueOf(100)));
    exprNodeDesc rhs = new exprNodeFuncDesc(
        Constants.DOUBLE_TYPE_NAME,
        TypeInfoFactory.doubleTypeInfo,
        FunctionRegistry.getUDFClass(Constants.DOUBLE_TYPE_NAME),
        FunctionRegistry.getUDFMethod(Constants.DOUBLE_TYPE_NAME, TypeInfoFactory.longTypeInfo),
View Full Code Here

    try {
      System.out.println("Testing Filter Operator");
      exprNodeDesc col0 = TestExecDriver.getStringColumn("col0");
      exprNodeDesc col1 = TestExecDriver.getStringColumn("col1");
      exprNodeDesc col2 = TestExecDriver.getStringColumn("col2");
      exprNodeDesc zero = new exprNodeConstantDesc("0");
      exprNodeDesc func1 = TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc(">", col2, col1);
      exprNodeDesc func2 = TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc("==", col0, zero);
      exprNodeDesc func3 = TypeCheckProcFactory.DefaultExprProcessor.getFuncExprNodeDesc("&&", func1, func2);
      assert(func3 != null);
      filterDesc filterCtx = new filterDesc(func3, false);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.ql.plan.exprNodeConstantDesc

Copyright © 2018 www.massapicom. 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.