当前位置: 首页>>代码示例>>Java>>正文


Java OpType类代码示例

本文整理汇总了Java中org.apache.pig.Expression.OpType的典型用法代码示例。如果您正苦于以下问题:Java OpType类的具体用法?Java OpType怎么用?Java OpType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OpType类属于org.apache.pig.Expression包,在下文中一共展示了OpType类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: partitionFilterToWhereClauseString

import org.apache.pig.Expression.OpType; //导入依赖的package包/类
/**
 * Return cql where clauses for the corresponding partition filter. Make sure the data format matches
 * Only support the following Pig data types: int, long, float, double, boolean and chararray
 * */
private String partitionFilterToWhereClauseString(Expression expression) throws IOException
{
    Expression.BinaryExpression be = (Expression.BinaryExpression) expression;
    OpType op = expression.getOpType();
    String opString = op.toString();
    switch (op)
    {
        case OP_EQ:
            opString = " = ";
        case OP_GE:
        case OP_GT:
        case OP_LE:
        case OP_LT:
            String name = be.getLhs().toString();
            String value = be.getRhs().toString();
            return String.format("%s %s %s", name, opString, value);
        case OP_AND:
            return String.format("%s AND %s", partitionFilterToWhereClauseString(be.getLhs()), partitionFilterToWhereClauseString(be.getRhs()));
        default:
            throw new IOException("Unsupported expression type: " + opString);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:27,代码来源:CqlNativeStorage.java

示例2: partitionFilterToWhereClauseString

import org.apache.pig.Expression.OpType; //导入依赖的package包/类
/** 
 * Return cql where clauses for the corresponding partition filter. Make sure the data format matches 
 * Only support the following Pig data types: int, long, float, double, boolean and chararray
 * */
private String partitionFilterToWhereClauseString(Expression expression) throws IOException
{
    Expression.BinaryExpression be = (Expression.BinaryExpression) expression;
    OpType op = expression.getOpType();
    String opString = op.toString();
    switch (op)
    {
        case OP_EQ:
            opString = " = ";
        case OP_GE:
        case OP_GT:
        case OP_LE:
        case OP_LT:
            String name = be.getLhs().toString();
            String value = be.getRhs().toString();
            return String.format("%s %s %s", name, opString, value);
        case OP_AND:
            return String.format("%s AND %s", partitionFilterToWhereClauseString(be.getLhs()), partitionFilterToWhereClauseString(be.getRhs()));
        default:
            throw new IOException("Unsupported expression type: " + opString);
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:27,代码来源:CqlStorage.java

示例3: partitionFilterToWhereClauseString

import org.apache.pig.Expression.OpType; //导入依赖的package包/类
/** 
 * Return cql where clauses for the corresponding partition filter. Make sure the data format matches 
 * Only support the following Pig data types: int, long, float, double, boolean and chararray
 * */
private String partitionFilterToWhereClauseString(Expression expression)
{
    Expression.BinaryExpression be = (Expression.BinaryExpression) expression;
    String name = be.getLhs().toString();
    String value = be.getRhs().toString();
    OpType op = expression.getOpType();
    String opString = op.name();
    switch (op)
    {
        case OP_EQ:
            opString = " = ";
        case OP_GE:
        case OP_GT:
        case OP_LE:
        case OP_LT:
            return String.format("%s %s %s", name, opString, value);
        case OP_AND:
            return String.format("%s AND %s", partitionFilterToWhereClauseString(be.getLhs()), partitionFilterToWhereClauseString(be.getRhs()));
        default:
            throw new RuntimeException("Unsupported expression type: " + opString);
    }
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:27,代码来源:CqlStorage.java

示例4: partitionFilterToWhereClauseString

import org.apache.pig.Expression.OpType; //导入依赖的package包/类
/** 
 * Return cql where clauses for the corresponding partition filter. Make sure the data format matches 
 * Only support the following Pig data types: int, long, float, double, boolean and chararray
 * */
private String partitionFilterToWhereClauseString(Expression expression) throws IOException
{
    Expression.BinaryExpression be = (Expression.BinaryExpression) expression;
    String name = be.getLhs().toString();
    String value = be.getRhs().toString();
    OpType op = expression.getOpType();
    String opString = op.toString();
    switch (op)
    {
        case OP_EQ:
            opString = " = ";
        case OP_GE:
        case OP_GT:
        case OP_LE:
        case OP_LT:
            return String.format("%s %s %s", name, opString, value);
        case OP_AND:
            return String.format("%s AND %s", partitionFilterToWhereClauseString(be.getLhs()), partitionFilterToWhereClauseString(be.getRhs()));
        default:
            throw new IOException("Unsupported expression type: " + opString);
    }
}
 
开发者ID:wso2,项目名称:wso2-cassandra,代码行数:27,代码来源:CqlStorage.java

示例5: getSupportedExpressionTypes

import org.apache.pig.Expression.OpType; //导入依赖的package包/类
@Override
public List<OpType> getSupportedExpressionTypes() {
    List<OpType> types = new ArrayList<OpType>();
    types.add(OpType.OP_EQ);
    types.add(OpType.OP_NE);
    types.add(OpType.OP_GT);
    types.add(OpType.OP_GE);
    types.add(OpType.OP_LT);
    types.add(OpType.OP_LE);
    types.add(OpType.OP_IN);
    types.add(OpType.OP_BETWEEN);
    types.add(OpType.OP_NULL);
    types.add(OpType.OP_NOT);
    types.add(OpType.OP_AND);
    types.add(OpType.OP_OR);
    return types;
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:18,代码来源:OrcStorage.java

示例6: getSearchArgument

import org.apache.pig.Expression.OpType; //导入依赖的package包/类
@VisibleForTesting
SearchArgument getSearchArgument(Expression expr) {
    if (expr == null) {
        return null;
    }
    Builder builder = SearchArgumentFactory.newBuilder();
    boolean beginWithAnd = !(expr.getOpType().equals(OpType.OP_AND) || expr.getOpType().equals(OpType.OP_OR) || expr.getOpType().equals(OpType.OP_NOT));
    if (beginWithAnd) {
        builder.startAnd();
    }
    buildSearchArgument(expr, builder);
    if (beginWithAnd) {
        builder.end();
    }
    SearchArgument sArg = builder.build();
    return sArg;
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:18,代码来源:OrcStorage.java

示例7: getPColCondition

import org.apache.pig.Expression.OpType; //导入依赖的package包/类
/**
 * @return the condition on partition columns extracted from filter
 */
public  Expression getPColCondition(){
   if(!canPushDown || 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);
	}
	return cond;
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:16,代码来源:PColFilterExtractor.java

示例8: visit

import org.apache.pig.Expression.OpType; //导入依赖的package包/类
@Override
public void visit() throws FrontendException {
    super.visit();
    if (supportedOpTypes.contains(OpType.OP_BETWEEN)) {
        // TODO: Collapse multiple ORs into BETWEEN
    } else if (supportedOpTypes.contains(OpType.OP_IN)) {
        // TODO: Collapse multiple ORs into IN
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:10,代码来源:PredicatePushDownFilterExtractor.java

示例9: isSupportedOpType

import org.apache.pig.Expression.OpType; //导入依赖的package包/类
@Override
protected boolean isSupportedOpType(BinaryExpression binOp) {
    if(binOp instanceof AddExpression) {
        return supportedOpTypes.contains(OpType.OP_PLUS );
    } else if(binOp instanceof SubtractExpression) {
        return supportedOpTypes.contains(OpType.OP_MINUS);
    } else if(binOp instanceof MultiplyExpression) {
        return supportedOpTypes.contains(OpType.OP_TIMES);
    } else if(binOp instanceof DivideExpression) {
        return supportedOpTypes.contains(OpType.OP_DIV);
    } else if(binOp instanceof ModExpression) {
        return supportedOpTypes.contains(OpType.OP_MOD);
    } else if(binOp instanceof AndExpression) {
        return supportedOpTypes.contains(OpType.OP_AND);
    } else if(binOp instanceof OrExpression) {
        return supportedOpTypes.contains(OpType.OP_OR);
    } else if(binOp instanceof EqualExpression) {
        return supportedOpTypes.contains(OpType.OP_EQ);
    } else if(binOp instanceof NotEqualExpression) {
        return supportedOpTypes.contains(OpType.OP_NE);
    } else if(binOp instanceof GreaterThanExpression) {
        return supportedOpTypes.contains(OpType.OP_GT);
    } else if(binOp instanceof GreaterThanEqualExpression) {
        return supportedOpTypes.contains(OpType.OP_GE);
    } else if(binOp instanceof LessThanExpression) {
        return supportedOpTypes.contains(OpType.OP_LT);
    } else if(binOp instanceof LessThanEqualExpression) {
        return supportedOpTypes.contains(OpType.OP_LE);
    } else if(binOp instanceof RegexExpression) {
        return supportedOpTypes.contains(OpType.OP_MATCH);
    } else {
        return false;
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:35,代码来源:PredicatePushDownFilterExtractor.java

示例10: oneTimeSetup

import org.apache.pig.Expression.OpType; //导入依赖的package包/类
@BeforeClass
public static void oneTimeSetup() throws Exception{
    cluster = MiniGenericCluster.buildCluster();
    Util.copyFromLocalToCluster(cluster, basedir + "orc-file-11-format.orc", basedir + "orc-file-11-format.orc");
    Util.copyFromLocalToCluster(cluster, basedir + "charvarchar.orc", basedir + "charvarchar.orc");
    createInputData();

    if(Util.WINDOWS){
        OUTPUT1 = OUTPUT1.replace("\\", "/");
        OUTPUT2 = OUTPUT2.replace("\\", "/");
        OUTPUT3 = OUTPUT3.replace("\\", "/");
        OUTPUT4 = OUTPUT4.replace("\\", "/");
    }

    supportedOpTypes = new ArrayList<OpType>();
    supportedOpTypes.add(OpType.OP_EQ);
    supportedOpTypes.add(OpType.OP_NE);
    supportedOpTypes.add(OpType.OP_GT);
    supportedOpTypes.add(OpType.OP_GE);
    supportedOpTypes.add(OpType.OP_LT);
    supportedOpTypes.add(OpType.OP_LE);
    supportedOpTypes.add(OpType.OP_IN);
    supportedOpTypes.add(OpType.OP_BETWEEN);
    supportedOpTypes.add(OpType.OP_NULL);
    supportedOpTypes.add(OpType.OP_NOT);
    supportedOpTypes.add(OpType.OP_AND);
    supportedOpTypes.add(OpType.OP_OR);

    Logger logger = Logger.getLogger(ColumnPruneVisitor.class);
    logger.removeAllAppenders();
    logger.setLevel(Level.INFO);
    SimpleLayout layout = new SimpleLayout();
    logFile = File.createTempFile("log", "");
    FileAppender appender = new FileAppender(layout, logFile.toString(), false, false, 0);
    logger.addAppender(appender);
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:37,代码来源:TestOrcStoragePushdown.java

示例11: getExpression

import org.apache.pig.Expression.OpType; //导入依赖的package包/类
public Expression getExpression(LogicalExpression op) throws FrontendException
 {
	if(op instanceof ConstantExpression) {
		ConstantExpression constExpr =(ConstantExpression)op ;
		return new Expression.Const( constExpr.getValue() );
	} else if (op instanceof ProjectExpression) {
		ProjectExpression projExpr = (ProjectExpression)op;
		String fieldName = projExpr.getFieldSchema().alias;
           return new Expression.Column(fieldName);
       } else {
		if( !( op instanceof BinaryExpression ) ) {
           logInternalErrorAndSetFlag();
           return null;
		}
		BinaryExpression binOp = (BinaryExpression)op;
		if(binOp instanceof AddExpression) {
			return getExpression( binOp, OpType.OP_PLUS );
		} else if(binOp instanceof SubtractExpression) {
			return getExpression(binOp, OpType.OP_MINUS);
		} else if(binOp instanceof MultiplyExpression) {
			return getExpression(binOp, OpType.OP_TIMES);
		} else if(binOp instanceof DivideExpression) {
			return getExpression(binOp, OpType.OP_DIV);
		} else if(binOp instanceof ModExpression) {
			return getExpression(binOp, OpType.OP_MOD);
		} else if(binOp instanceof AndExpression) {
			return getExpression(binOp, OpType.OP_AND);
		} else if(binOp instanceof OrExpression) {
			return getExpression(binOp, OpType.OP_OR);
		} else if(binOp instanceof EqualExpression) {
			return getExpression(binOp, OpType.OP_EQ);
		} else if(binOp instanceof NotEqualExpression) {
			return getExpression(binOp, OpType.OP_NE);
		} else if(binOp instanceof GreaterThanExpression) {
			return getExpression(binOp, OpType.OP_GT);
		} else if(binOp instanceof GreaterThanEqualExpression) {
			return getExpression(binOp, OpType.OP_GE);
		} else if(binOp instanceof LessThanExpression) {
			return getExpression(binOp, OpType.OP_LT);
		} else if(binOp instanceof LessThanEqualExpression) {
			return getExpression(binOp, OpType.OP_LE);
                       } else if(binOp instanceof RegexExpression) {
                               return getExpression(binOp, OpType.OP_MATCH);
		} else {
           logInternalErrorAndSetFlag();
		}
	}
	return null;
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:50,代码来源:PColFilterExtractor.java

示例12: getExpression

import org.apache.pig.Expression.OpType; //导入依赖的package包/类
public Expression getExpression(LogicalExpression op) throws FrontendException
{
    if(op == null) {
        return null;
    }
    if(op instanceof ConstantExpression) {
        ConstantExpression constExpr =(ConstantExpression)op ;
        return new Expression.Const( constExpr.getValue() );
    } else if (op instanceof ProjectExpression) {
        ProjectExpression projExpr = (ProjectExpression)op;
        String fieldName = projExpr.getFieldSchema().alias;
        return new Expression.Column(fieldName);
    } else if(op instanceof BinaryExpression) {
        BinaryExpression binOp = (BinaryExpression)op;
        if(binOp instanceof AddExpression) {
            return getExpression( binOp, OpType.OP_PLUS );
        } else if(binOp instanceof SubtractExpression) {
            return getExpression(binOp, OpType.OP_MINUS);
        } else if(binOp instanceof MultiplyExpression) {
            return getExpression(binOp, OpType.OP_TIMES);
        } else if(binOp instanceof DivideExpression) {
            return getExpression(binOp, OpType.OP_DIV);
        } else if(binOp instanceof ModExpression) {
            return getExpression(binOp, OpType.OP_MOD);
        } else if(binOp instanceof AndExpression) {
            return getExpression(binOp, OpType.OP_AND);
        } else if(binOp instanceof OrExpression) {
            return getExpression(binOp, OpType.OP_OR);
        } else if(binOp instanceof EqualExpression) {
            return getExpression(binOp, OpType.OP_EQ);
        } else if(binOp instanceof NotEqualExpression) {
            return getExpression(binOp, OpType.OP_NE);
        } else if(binOp instanceof GreaterThanExpression) {
            return getExpression(binOp, OpType.OP_GT);
        } else if(binOp instanceof GreaterThanEqualExpression) {
            return getExpression(binOp, OpType.OP_GE);
        } else if(binOp instanceof LessThanExpression) {
            return getExpression(binOp, OpType.OP_LT);
        } else if(binOp instanceof LessThanEqualExpression) {
            return getExpression(binOp, OpType.OP_LE);
        } else if(binOp instanceof RegexExpression) {
            return getExpression(binOp, OpType.OP_MATCH);
        } else {
            LOG.error("Unsupported conversion of BinaryExpression to Expression: " + op.getName());
            throw new FrontendException("Unsupported conversion of BinaryExpression to Expression: " + op.getName());
        }
    } else if(op instanceof UnaryExpression) {
        UnaryExpression unaryOp = (UnaryExpression)op;
        if(unaryOp instanceof IsNullExpression) {
            return getExpression(unaryOp, OpType.OP_NULL);
        } else if(unaryOp instanceof NotExpression) {
            return getExpression(unaryOp, OpType.OP_NOT);
        } else if(unaryOp instanceof CastExpression) {
            return getExpression(unaryOp.getExpression());
        } else {
            LOG.error("Unsupported conversion of UnaryExpression to Expression: " + op.getName());
            throw new FrontendException("Unsupported conversion of UnaryExpression to Expression: " + op.getName());
        }
    } else {
        LOG.error("Unsupported conversion of LogicalExpression to Expression: " + op.getName());
        throw new FrontendException("Unsupported conversion of LogicalExpression to Expression: " + op.getName());
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:64,代码来源:FilterExtractor.java

示例13: PredicatePushDownFilterExtractor

import org.apache.pig.Expression.OpType; //导入依赖的package包/类
public PredicatePushDownFilterExtractor(LogicalExpressionPlan plan, List<String> predicateCols,
        List<OpType> supportedOpTypes) {
    super(plan);
    this.predicateCols = predicateCols;
    this.supportedOpTypes = supportedOpTypes;
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:7,代码来源:PredicatePushDownFilterExtractor.java

示例14: getExpression

import org.apache.pig.Expression.OpType; //导入依赖的package包/类
public Expression getExpression(LogicalExpression op) throws FrontendException
 {
	if(op instanceof ConstantExpression) {
		ConstantExpression constExpr =(ConstantExpression)op ;
		return new Expression.Const( constExpr.getValue() );
	} else if (op instanceof ProjectExpression) {
		ProjectExpression projExpr = (ProjectExpression)op;
		String fieldName = projExpr.getFieldSchema().alias;
           return new Expression.Column(fieldName);
       } else {
		if( !( op instanceof BinaryExpression ) ) {
           logInternalErrorAndSetFlag();
           return null;
		}
		BinaryExpression binOp = (BinaryExpression)op;
		if(binOp instanceof AddExpression) {
			return getExpression( binOp, OpType.OP_PLUS );
		} else if(binOp instanceof SubtractExpression) {
			return getExpression(binOp, OpType.OP_MINUS);
		} else if(binOp instanceof MultiplyExpression) {
			return getExpression(binOp, OpType.OP_TIMES);
		} else if(binOp instanceof DivideExpression) {
			return getExpression(binOp, OpType.OP_DIV);
		} else if(binOp instanceof ModExpression) {
			return getExpression(binOp, OpType.OP_MOD);
		} else if(binOp instanceof AndExpression) {
			return getExpression(binOp, OpType.OP_AND);
		} else if(binOp instanceof OrExpression) {
			return getExpression(binOp, OpType.OP_OR);
		} else if(binOp instanceof EqualExpression) {
			return getExpression(binOp, OpType.OP_EQ);
		} else if(binOp instanceof NotEqualExpression) {
			return getExpression(binOp, OpType.OP_NE);
		} else if(binOp instanceof GreaterThanExpression) {
			return getExpression(binOp, OpType.OP_GT);
		} else if(binOp instanceof GreaterThanEqualExpression) {
			return getExpression(binOp, OpType.OP_GE);
		} else if(binOp instanceof LessThanExpression) {
			return getExpression(binOp, OpType.OP_LT);
		} else if(binOp instanceof LessThanEqualExpression) {
			return getExpression(binOp, OpType.OP_LE);
		} else {
           logInternalErrorAndSetFlag();
		}
	}
	return null;
}
 
开发者ID:PonIC,项目名称:PonIC,代码行数:48,代码来源:PColFilterExtractor.java


注:本文中的org.apache.pig.Expression.OpType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。