Package plan_runner.predicates

Examples of plan_runner.predicates.ComparisonPredicate


    visitBinaryOperation(et);

    final ValueExpression right = _exprStack.pop();
    final ValueExpression left = _exprStack.pop();

    final ComparisonPredicate cp = new ComparisonPredicate(ComparisonPredicate.EQUAL_OP, left,
        right);
    _predStack.push(cp);
  }
View Full Code Here


    visitBinaryOperation(gt);

    final ValueExpression right = _exprStack.pop();
    final ValueExpression left = _exprStack.pop();

    final ComparisonPredicate cp = new ComparisonPredicate(ComparisonPredicate.GREATER_OP,
        left, right);
    _predStack.push(cp);
  }
View Full Code Here

    visitBinaryOperation(gte);

    final ValueExpression right = _exprStack.pop();
    final ValueExpression left = _exprStack.pop();

    final ComparisonPredicate cp = new ComparisonPredicate(ComparisonPredicate.NONLESS_OP,
        left, right);
    _predStack.push(cp);
  }
View Full Code Here

    visitBinaryOperation(mt);

    final ValueExpression right = _exprStack.pop();
    final ValueExpression left = _exprStack.pop();

    final ComparisonPredicate cp = new ComparisonPredicate(ComparisonPredicate.LESS_OP, left,
        right);
    _predStack.push(cp);
  }
View Full Code Here

    visitBinaryOperation(mte);

    final ValueExpression right = _exprStack.pop();
    final ValueExpression left = _exprStack.pop();

    final ComparisonPredicate cp = new ComparisonPredicate(ComparisonPredicate.NONGREATER_OP,
        left, right);
    _predStack.push(cp);
  }
View Full Code Here

    visitBinaryOperation(net);

    final ValueExpression right = _exprStack.pop();
    final ValueExpression left = _exprStack.pop();

    final ComparisonPredicate cp = new ComparisonPredicate(ComparisonPredicate.NONEQUAL_OP,
        left, right);
    _predStack.push(cp);
  }
View Full Code Here

  public Predicate comparisonPredAnalyse(Predicate toAnalyse) {
    if (!(toAnalyse instanceof ComparisonPredicate))
      return toAnalyse;

    // Check if is Double or Integer
    ComparisonPredicate compToAnalyse = (ComparisonPredicate) toAnalyse;
    List<ValueExpression> followUps = compToAnalyse.getExpressions();

    // if one of the previous change to Double
    toAnalyse = getSameForDouble(toAnalyse);

    compToAnalyse = (ComparisonPredicate) toAnalyse;
    followUps = compToAnalyse.getExpressions();

    ValueExpression leftPart = null;
    try {
      leftPart = combine(null, 0, followUps.get(0));
    } catch (final Exception e) {
      return toAnalyse;
    }

    ValueExpression rightPart = null;
    try {
      rightPart = combine(null, 0, followUps.get(1));
    } catch (final Exception e) {
      return toAnalyse;
    }

    boolean temp = false;
    getInfo(leftPart, temp, 0);
    temp = false;
    getInfo(rightPart, temp, 1);

    if (Parameter[0] == null)
      Parameter[0] = new ValueSpecification<Double>(numConv, 1.0);
    if (Parameter[1] == null)
      Parameter[1] = new ValueSpecification<Double>(numConv, 1.0);

    Parameter[0].inverseNumber();
    ValueExpression fullClean = null;
    if (CleanPart[0] != null) {
      if (CleanPart[1] != null)
        fullClean = new Subtraction<Double>(CleanPart[1], CleanPart[0]);
      else if (CleanPart[1] == null) {
        final ValueExpression temp1 = new ValueSpecification<Double>(numConv, 0.0);
        fullClean = new Subtraction<Double>(temp1, CleanPart[0]);
      }
    } else if (CleanPart[0] == null)
      if (CleanPart[1] != null)
        fullClean = CleanPart[1];
      else
        fullClean = new ValueSpecification(numConv, 0.0);

    fullClean = combine(null, 0, fullClean);
    ValueExpression finalA = new Multiplication<Double>(Parameter[0], Parameter[1]);
    finalA = combine(null, 0, finalA);
    ValueExpression finalB = new Multiplication<Double>(Parameter[0], fullClean);
    finalB = combine(null, 0, finalB);

    final ValueExpression withVariable = new Multiplication<Double>(finalA, Variable[1]);
    final ValueExpression finalRightPart = new Addition<Double>(withVariable, finalB);

    Predicate finalPred;
    if (Parameter[0].isNegative())
      finalPred = new ComparisonPredicate(compToAnalyse.getOperator(true), Variable[0],
          finalRightPart);
    else
      finalPred = new ComparisonPredicate(compToAnalyse.getOperator(false), Variable[0],
          finalRightPart);
    return finalPred;
  }
View Full Code Here

      param = false;
    }
  }

  Predicate getSameForDouble(Predicate pred) {
    final ComparisonPredicate compPred = (ComparisonPredicate) pred;

    final List<ValueExpression> followUps = compPred.getExpressions();

    final ValueExpression left = changeToDouble(followUps.get(0));
    final ValueExpression right = changeToDouble(followUps.get(1));

    final Predicate finalPred = new ComparisonPredicate<Double>(compPred.getOperator(false),
        left, right);
    return finalPred;
  }
View Full Code Here

  public TPCH3L23Plan(String dataPath, String extension, Map conf) {

    // -------------------------------------------------------------------------------------
    final List<Integer> hashCustomer = Arrays.asList(0);

    final SelectOperator selectionCustomer = new SelectOperator(new ComparisonPredicate(
        new ColumnReference(_sc, 6), new ValueSpecification(_sc, _customerMktSegment)));

    final ProjectOperator projectionCustomer = new ProjectOperator(new int[] { 0 });

    final DataSourceComponent relationCustomer = new DataSourceComponent("CUSTOMER", dataPath
        + "customer" + extension, _queryPlan).setHashIndexes(hashCustomer)
        .addOperator(selectionCustomer).addOperator(projectionCustomer);

    // -------------------------------------------------------------------------------------
    final List<Integer> hashOrders = Arrays.asList(1);

    final SelectOperator selectionOrders = new SelectOperator(new ComparisonPredicate(
        ComparisonPredicate.LESS_OP, new ColumnReference(_dateConv, 4),
        new ValueSpecification(_dateConv, _date)));

    final ProjectOperator projectionOrders = new ProjectOperator(new int[] { 0, 1, 4, 7 });

    final DataSourceComponent relationOrders = new DataSourceComponent("ORDERS", dataPath
        + "orders" + extension, _queryPlan).setHashIndexes(hashOrders)
        .addOperator(selectionOrders).addOperator(projectionOrders);

    new EquiJoinComponent(relationCustomer, relationOrders, _queryPlan).addOperator(
        new ProjectOperator(new int[] { 1, 2, 3 })).setHashIndexes(Arrays.asList(0));

    // -------------------------------------------------------------------------------------
    final List<Integer> hashLineitem = Arrays.asList(0);

    final SelectOperator selectionLineitem = new SelectOperator(new ComparisonPredicate(
        ComparisonPredicate.GREATER_OP, new ColumnReference(_dateConv, 10),
        new ValueSpecification(_dateConv, _date)));

    final ProjectOperator projectionLineitem = new ProjectOperator(new int[] { 0, 5, 6 });
View Full Code Here

  public TPCH3L1Plan(String dataPath, String extension, Map conf) {

    // -------------------------------------------------------------------------------------
    final List<Integer> hashCustomer = Arrays.asList(0);

    final SelectOperator selectionCustomer = new SelectOperator(new ComparisonPredicate(
        new ColumnReference(_sc, 6), new ValueSpecification(_sc, _customerMktSegment)));

    final ProjectOperator projectionCustomer = new ProjectOperator(new int[] { 0 });

    new DataSourceComponent("CUSTOMER", dataPath + "customer" + extension, _queryPlan)
        .setHashIndexes(hashCustomer).addOperator(selectionCustomer)
        .addOperator(projectionCustomer).setPrintOut(false);

    // -------------------------------------------------------------------------------------
    final List<Integer> hashOrders = Arrays.asList(1);

    final SelectOperator selectionOrders = new SelectOperator(new ComparisonPredicate(
        ComparisonPredicate.LESS_OP, new ColumnReference(_dateConv, 4),
        new ValueSpecification(_dateConv, _date)));

    final ProjectOperator projectionOrders = new ProjectOperator(new int[] { 0, 1, 4, 7 });
View Full Code Here

TOP

Related Classes of plan_runner.predicates.ComparisonPredicate

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.