本文整理汇总了Java中org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPAnd类的典型用法代码示例。如果您正苦于以下问题:Java GenericUDFOPAnd类的具体用法?Java GenericUDFOPAnd怎么用?Java GenericUDFOPAnd使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GenericUDFOPAnd类属于org.apache.hadoop.hive.ql.udf.generic包,在下文中一共展示了GenericUDFOPAnd类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addChildNode
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPAnd; //导入依赖的package包/类
@Override
public void addChildNode( final ExprNodeGenericFuncDesc exprNodeDesc ){
GenericUDF udf = exprNodeDesc.getGenericUDF();
if( udf instanceof GenericUDFOPAnd ){
childNodeList.add( new HiveExprAndNode( exprNodeDesc.getChildren() ) );
}
else if( udf instanceof GenericUDFOPOr ){
childNodeList.add( new HiveExprOrNode( exprNodeDesc.getChildren() ) );
}
else if( udf instanceof GenericUDFOPNot ){
childNodeList.add( new HiveExprNotNode( exprNodeDesc.getChildren() ) );
}
else{
childNodeList.add( HiveExprFactory.get( exprNodeDesc , udf , exprNodeDesc.getChildren() ) );
}
}
示例2: convertToExpression
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPAnd; //导入依赖的package包/类
/**
* Convert generic Ampool filter(s) to the corresponding generic UDF(s).
*
* @param filter the Ampool filters
* @param td the Ampool table descriptor
* @return the generic ORC predicates
*/
public static ExprNodeDesc convertToExpression(final Filter filter, final TableDescriptor td)
throws IOException {
if (filter instanceof FilterList) {
FilterList fl = (FilterList) filter;
ExprNodeDesc expression = new ExprNodeGenericFuncDesc(TypeInfoFactory.booleanTypeInfo,
fl.getOperator() == FilterList.Operator.MUST_PASS_ALL ? new GenericUDFOPAnd()
: new GenericUDFOPOr(),
new ArrayList<>());
for (Filter f : fl.getFilters()) {
expression.getChildren().add(convertToExpression(f, td));
}
return expression;
} else if (filter instanceof SingleColumnValueFilter) {
SingleColumnValueFilter cf = (SingleColumnValueFilter) filter;
if (!UDF_CONVERT_MAP.containsKey(cf.getOperator())) {
throw new IOException("Failed to convert ComparisonOperator: " + cf.getOperator());
}
return UDF_CONVERT_MAP.get(cf.getOperator()).apply(cf, td);
} else {
return null;
}
}
示例3: testPredicate_Multiple_1
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPAnd; //导入依赖的package包/类
@Test
public void testPredicate_Multiple_1() {
ExprNodeDesc expr1 = getExprNodeDesc(TypeInfoFactory.intTypeInfo, "c1", 10, TypeInfoFactory.booleanTypeInfo, new GenericUDFOPEqual());
ExprNodeDesc expr2 = getExprNodeDesc(TypeInfoFactory.intTypeInfo, "c1", 10, TypeInfoFactory.booleanTypeInfo, new GenericUDFOPEqual());
ExprNodeDesc exprT = new ExprNodeGenericFuncDesc(TypeInfoFactory.booleanTypeInfo, new GenericUDFOPAnd(), new ArrayList<>(2));
exprT.getChildren().add(expr1);
exprT.getChildren().add(expr2);
DecomposedPredicate dp = MonarchPredicateHandler.decomposePredicate(null, serDe, exprT);
assertNotNull(dp);
assertNotNull(dp.pushedPredicate);
assertNull(dp.residualPredicate);
assertEquals(dp.pushedPredicate.toString(), exprT.toString());
}
示例4: testPredicate_Multiple_2
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPAnd; //导入依赖的package包/类
@Test
public void testPredicate_Multiple_2() {
ExprNodeDesc expr1 = getExprNodeDesc(TypeInfoFactory.intTypeInfo, "c1", 10, TypeInfoFactory.booleanTypeInfo, new GenericUDFOPEqual());
ExprNodeDesc expr2 = getExprNodeDesc(TypeInfoFactory.intTypeInfo, "c1", 100, TypeInfoFactory.booleanTypeInfo, new GenericUDFOPLessThan());
ExprNodeDesc exprT = new ExprNodeGenericFuncDesc(TypeInfoFactory.booleanTypeInfo, new GenericUDFOPAnd(), new ArrayList<>(2));
exprT.getChildren().add(expr1);
exprT.getChildren().add(expr2);
DecomposedPredicate dp = MonarchPredicateHandler.decomposePredicate(null, serDe, exprT);
assertNotNull(dp);
assertNotNull(dp.pushedPredicate);
assertNull(dp.residualPredicate);
assertEquals(dp.pushedPredicate.toString(), exprT.toString());
}
示例5: testPredicate_Multiple_3
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPAnd; //导入依赖的package包/类
@Test
public void testPredicate_Multiple_3() {
ExprNodeDesc expr1 = getExprNodeDesc(TypeInfoFactory.intTypeInfo, "c1", 10, TypeInfoFactory.booleanTypeInfo, new GenericUDFOPEqual());
ExprNodeDesc expr2 = getExprNodeDesc(TypeInfoFactory.intTypeInfo, "c1", 10, TypeInfoFactory.booleanTypeInfo, new GenericUDFOPMinus());
ExprNodeDesc exprT = new ExprNodeGenericFuncDesc(TypeInfoFactory.booleanTypeInfo, new GenericUDFOPAnd(), new ArrayList<>(2));
exprT.getChildren().add(expr1);
exprT.getChildren().add(expr2);
DecomposedPredicate dp = MonarchPredicateHandler.decomposePredicate(null, serDe, exprT);
assertNotNull(dp);
assertNotNull(dp.pushedPredicate);
assertNotNull(dp.residualPredicate);
assertEquals(dp.pushedPredicate.toString(), expr1.toString());
assertEquals(dp.residualPredicate.toString(), expr2.toString());
}
示例6: buildQuery
import org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPAnd; //导入依赖的package包/类
protected static void buildQuery(ExprNodeDesc input, StringBuilder fq, StringBuilder q) {
if (input instanceof ExprNodeGenericFuncDesc) {
ExprNodeGenericFuncDesc inputFunc = (ExprNodeGenericFuncDesc)input;
ExprNodeDesc inputLeft = inputFunc.getChildren().get(0);
ExprNodeDesc inputRight = inputFunc.getChildren().get(1);
if ((inputFunc.getGenericUDF() instanceof GenericUDFOPOr) || (inputFunc.getGenericUDF() instanceof GenericUDFOPAnd)) {
StringBuilder fqLeft = new StringBuilder();
StringBuilder fqRight = new StringBuilder();
buildQuery(inputLeft,fqLeft,q);
buildQuery(inputRight,fqRight,q);
if (fqLeft.length()>0 && fqRight.length()>0) {
fq.append("(").append(fqLeft).append(") ");
fq.append( (inputFunc.getGenericUDF() instanceof GenericUDFOPOr) ? "OR" : "AND");
fq.append("(").append(fqRight).append(") ");
} else if (fqLeft.length()>0) {
fq.append(fqLeft);
} else if (fqRight.length()>0) {
fq.append(fqRight);
}
} else if (inputFunc.getGenericUDF() instanceof GenericUDFOPEqual) {
if ((inputLeft instanceof ExprNodeColumnDesc) && (inputRight instanceof ExprNodeConstantDesc)) {
if (((ExprNodeColumnDesc)inputLeft).getColumn().equalsIgnoreCase("solr_query")) {
q.append(((ExprNodeConstantDesc)inputRight).getValue().toString());
} else {
fq.append(((ExprNodeColumnDesc)inputLeft).getColumn());
fq.append(":");
fq.append(((ExprNodeConstantDesc)inputRight).getValue().toString());
}
} else {
if (((ExprNodeColumnDesc)inputRight).getColumn().equalsIgnoreCase("solr_query")) {
q.append(((ExprNodeConstantDesc)inputLeft).getValue());
} else {
fq.append(((ExprNodeColumnDesc)inputRight).getColumn());
fq.append(":");
fq.append(((ExprNodeConstantDesc)inputLeft).getValue().toString());
}
}
}
}
return;
}