Package org.apache.pig

Examples of org.apache.pig.Expression


          setupColNameMaps();
          PColFilterExtractor pColFilterFinder = new PColFilterExtractor(
              loFilter.getFilterPlan(), getMappedKeys( partitionKeys ) );
          pColFilterFinder.visit();
          Expression partitionFilter = pColFilterFinder.getPColCondition();
          if(partitionFilter != null) {
            // the column names in the filter may be the ones provided by
            // the user in the schema in the load statement - we may need
            // to replace them with partition column names as given by
            // LoadFunc.getSchema()
View Full Code Here


   * @return the condition on partition columns extracted from filter
   */
  public  Expression getPColCondition(){
    if(pColConditions.size() == 0)
      return null;
    Expression cond =  pColConditions.get(0);
    for(int i=1; i<pColConditions.size(); i++){
      //if there is more than one condition expression
      // connect them using "AND"s
      cond = new Expression.BinaryExpression(cond, pColConditions.get(i),
                    OpType.OP_AND);
View Full Code Here

        try {
            setupColNameMaps();
            PColFilterExtractor pColFilterFinder = new PColFilterExtractor(
                    loFilter.getComparisonPlan(), getMappedKeys(partitionKeys));
            pColFilterFinder.visit();
            Expression partitionFilter = pColFilterFinder.getPColCondition();
            if(partitionFilter != null) {
                // the column names in the filter may be the ones provided by
                // the user in the schema in the load statement - we may need
                // to replace them with partition column names as given by
                // LoadFunc.getSchema()
View Full Code Here

     * @return the condition on partition columns extracted from filter
     */
    public  Expression getPColCondition(){
        if(pColConditions.size() == 0)
            return null;
        Expression cond =  pColConditions.get(0);
        for(int i=1; i<pColConditions.size(); i++){
            //if there is more than one condition expression
            // connect them using "AND"s
            cond = new BinaryExpression(cond, pColConditions.get(i),
                    OpType.OP_AND);
View Full Code Here

        try {
            setupColNameMaps();
            PColFilterExtractor pColFilterFinder = new PColFilterExtractor(
                    loFilter.getComparisonPlan(), getMappedKeys(partitionKeys));
            pColFilterFinder.visit();
            Expression partitionFilter = pColFilterFinder.getPColCondition();
            if(partitionFilter != null) {
                // the column names in the filter may be the ones provided by
                // the user in the schema in the load statement - we may need
                // to replace them with partition column names as given by
                // LoadFunc.getSchema()
View Full Code Here

            setupColNameMaps();

            PredicatePushDownFilterExtractor filterFinder = new PredicatePushDownFilterExtractor(
                    loFilter.getFilterPlan(), getMappedKeys( predicateFields ), loadPredPushdown.getSupportedExpressionTypes() );
            filterFinder.visit();
            Expression pushDownPredicate = filterFinder.getPushDownExpression();

            if(pushDownPredicate != null) {
                // the column names in the filter may be the ones provided by
                // the user in the schema in the load statement - we may need
                // to replace them with partition column names as given by
View Full Code Here

          setupColNameMaps();

            FilterExtractor filterFinder = new PartitionFilterExtractor(loFilter.getFilterPlan(),
                    getMappedKeys(partitionKeys));
            filterFinder.visit();
            Expression partitionFilter = filterFinder.getPushDownExpression();

            if(partitionFilter != null) {
                // the column names in the filter may be the ones provided by
                // the user in the schema in the load statement - we may need
                // to replace them with partition column names as given by
View Full Code Here

        return sArg;
    }

    private void buildSearchArgument(Expression expr, Builder builder) {
        if (expr instanceof BinaryExpression) {
            Expression lhs = ((BinaryExpression) expr).getLhs();
            Expression rhs = ((BinaryExpression) expr).getRhs();
            switch (expr.getOpType()) {
            case OP_AND:
                builder.startAnd();
                buildSearchArgument(lhs, builder);
                buildSearchArgument(rhs, builder);
                builder.end();
                break;
            case OP_OR:
                builder.startOr();
                buildSearchArgument(lhs, builder);
                buildSearchArgument(rhs, builder);
                builder.end();
                break;
            case OP_EQ:
                builder.equals(getColumnName(lhs), getExpressionValue(rhs));
                break;
            case OP_NE:
                builder.startNot();
                builder.equals(getColumnName(lhs), getExpressionValue(rhs));
                builder.end();
                break;
            case OP_LT:
                builder.lessThan(getColumnName(lhs), getExpressionValue(rhs));
                break;
            case OP_LE:
                builder.lessThanEquals(getColumnName(lhs), getExpressionValue(rhs));
                break;
            case OP_GT:
                builder.startNot();
                builder.lessThanEquals(getColumnName(lhs), getExpressionValue(rhs));
                builder.end();
                break;
            case OP_GE:
                builder.startNot();
                builder.lessThan(getColumnName(lhs), getExpressionValue(rhs));
                builder.end();
                break;
            case OP_BETWEEN:
                BetweenExpression between = (BetweenExpression) rhs;
                builder.between(getColumnName(lhs), getSearchArgObjValue(between.getLower()),  getSearchArgObjValue(between.getUpper()));
            case OP_IN:
                InExpression in = (InExpression) rhs;
                builder.in(getColumnName(lhs), getSearchArgObjValues(in.getValues()).toArray());
            default:
                throw new RuntimeException("Unsupported binary expression type: " + expr.getOpType() + " in " + expr);
            }
        } else if (expr instanceof UnaryExpression) {
            Expression unaryExpr = ((UnaryExpression) expr).getExpression();
            switch (expr.getOpType()) {
            case OP_NULL:
                builder.isNull(getColumnName(unaryExpr));
                break;
            case OP_NOT:
View Full Code Here

          setupColNameMaps();
         
          FilterExtractor filterFinder = new FilterExtractor(
                    loFilter.getFilterPlan(), getMappedKeys( partitionKeys ) );
            filterFinder.visit();
            Expression partitionFilter = filterFinder.getPColCondition();

            if(partitionFilter != null) {
                // the column names in the filter may be the ones provided by
                // the user in the schema in the load statement - we may need
                // to replace them with partition column names as given by
View Full Code Here

          LogicalExpressionPlan filterExprCopy = filterExpr.deepCopy();
         
          PColFilterExtractor pColFilterFinder = new PColFilterExtractor(
                  filterExprCopy, getMappedKeys( partitionKeys ) );
          pColFilterFinder.visit();
          Expression partitionFilter = pColFilterFinder.getPColCondition();
         
          if(partitionFilter != null) {
            // the column names in the filter may be the ones provided by
            // the user in the schema in the load statement - we may need
            // to replace them with partition column names as given by
View Full Code Here

TOP

Related Classes of org.apache.pig.Expression

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.