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


Java Expression.Column方法代码示例

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


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

示例1: getExpression

import org.apache.pig.Expression; //导入方法依赖的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

示例2: getExpression

import org.apache.pig.Expression; //导入方法依赖的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


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