當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。