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


Java GenericUDFOPAnd类代码示例

本文整理汇总了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() ) );
  }
}
 
开发者ID:yahoojapan,项目名称:multiple-dimension-spread,代码行数:17,代码来源:HiveExprOrNode.java

示例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;
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:30,代码来源:OrcUtils.java

示例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());
}
 
开发者ID:ampool,项目名称:monarch,代码行数:14,代码来源:MonarchPredicateHandlerTest.java

示例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());
}
 
开发者ID:ampool,项目名称:monarch,代码行数:14,代码来源:MonarchPredicateHandlerTest.java

示例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());
}
 
开发者ID:ampool,项目名称:monarch,代码行数:16,代码来源:MonarchPredicateHandlerTest.java

示例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;
}
 
开发者ID:vroyer,项目名称:hive-solr-search,代码行数:44,代码来源:SolrStorageHandler.java


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