當前位置: 首頁>>代碼示例>>Java>>正文


Java DecomposedPredicate類代碼示例

本文整理匯總了Java中org.apache.hadoop.hive.ql.metadata.HiveStoragePredicateHandler.DecomposedPredicate的典型用法代碼示例。如果您正苦於以下問題:Java DecomposedPredicate類的具體用法?Java DecomposedPredicate怎麽用?Java DecomposedPredicate使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DecomposedPredicate類屬於org.apache.hadoop.hive.ql.metadata.HiveStoragePredicateHandler包,在下文中一共展示了DecomposedPredicate類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: decomposePredicate

import org.apache.hadoop.hive.ql.metadata.HiveStoragePredicateHandler.DecomposedPredicate; //導入依賴的package包/類
/**
 * Decompose the predicates (filter expressions) provided in hive query and if some
 * predicates can be pushed down to the Monarch, use them at query time reduce the
 * data queried from Monarch (Geode). The residual predicates (the ones that cannot
 * be executed on Monarch/Geode) will need to be executed in hive query engine.
 * <p>
 * The predicates to be executed on Monarch are decided by the column-type and
 * predicate operations. Following is the current list supported for execution
 * on Monarch/Geode side (as of 2015-12-23):
 * - Predicate Operations:
 * -- EQUAL
 * -- LESS THAN
 * -- LESS THAN OR EQUAL
 * - Column Types:
 * -- INT
 * -- LONG
 * -- STRING
 *
 * @param jobConf      the job configuration
 * @param deserializer the deserializer
 * @param exprNodeDesc the hive expression to be decpomposed
 * @return the decomposed predicate indicating which predicates will be executed on Monarch
 * and which predicates (residual) will be by Hive query engine
 */
public static DecomposedPredicate decomposePredicate(final JobConf jobConf,
                                                     final MonarchSerDe deserializer,
                                                     final ExprNodeDesc exprNodeDesc) {
  List<IndexSearchCondition> indexSearchConditions = new ArrayList<>(5);
  IndexPredicateAnalyzer ipa = getIndexPredicateAnalyzer(deserializer);
  ExprNodeDesc residual = ipa.analyzePredicate(exprNodeDesc, indexSearchConditions);
  ipa.clearAllowedColumnNames();
  if (indexSearchConditions.isEmpty()) {
    if (logger.isDebugEnabled())
      logger.debug("nothing to decompose. Returning");
    return null;
  }

  DecomposedPredicate dp = new DecomposedPredicate();
  dp.pushedPredicate = ipa.translateSearchConditions(indexSearchConditions);
  dp.residualPredicate = (ExprNodeGenericFuncDesc) residual;
  dp.pushedPredicateObject = null;

  if (logger.isDebugEnabled()) {
    logger.debug("[To Monarch -->] PushedPredicate= {}", dp.pushedPredicate);
    logger.debug("[In Hive    -->] ResidualPredicate= {}", dp.residualPredicate);
  }
  return dp;
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:49,代碼來源:MonarchPredicateHandler.java

示例2: testPredicate_Single

import org.apache.hadoop.hive.ql.metadata.HiveStoragePredicateHandler.DecomposedPredicate; //導入依賴的package包/類
/**
 * Test single function predicates.
 *
 * @param exprNodeDesc  the node expression
 * @param checkPushed   the null check for pushed predicate
 * @param checkResidual the null check for residual predicate
 * @throws Exception
 */
@Test(dataProvider = "getDataForSinglePredicate")
public void testPredicate_Single(final ExprNodeDesc exprNodeDesc,
                                 final NullCheck checkPushed, final NullCheck checkResidual,
                                 final Filter expectedPredicate) throws
  Exception {

  DecomposedPredicate dp = MonarchPredicateHandler.decomposePredicate(null, serDe, exprNodeDesc);
  //assertNotNull(dp);
  //checkPushed.check(dp.pushedPredicate);
  //checkResidual.check(dp.residualPredicate);

  if (checkPushed.equals(NullCheck.NotNull)) {
    final String expression = Utilities.serializeExpression(dp.pushedPredicate);
    final String[] cols = Arrays.stream(properties.getProperty("columns").split(",")).toArray(String[]::new);
    MPredicateHolder[] phs1 = MonarchPredicateHandler.getPushDownPredicates(expression, cols);
    FilterList phs = MonarchPredicateHandler.getPushDownFilters(expression, cols);
    assertEquals(phs.getFilters().size(), 1);
    assertEquals(phs.getFilters().get(0).toString(), expectedPredicate.toString());
  }
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:29,代碼來源:MonarchPredicateHandlerTest.java

示例3: pushPredicate

import org.apache.hadoop.hive.ql.metadata.HiveStoragePredicateHandler.DecomposedPredicate; //導入依賴的package包/類
public DecomposedPredicate pushPredicate(Map<String, String> hiveTypeMapping, ExprNodeDesc
    predicate) {
  log.info("Checking predicates for pushdown in DynamoDB query");
  List<IndexSearchCondition> searchConditions = getGenericSearchConditions(hiveTypeMapping,
      predicate);
  log.info("Pushed predicates: " + searchConditions);
  if (searchConditions.isEmpty()) {
    return null;
  } else {
    List<IndexSearchCondition> finalSearchCondition =
        prioritizeSearchConditions(searchConditions);
    IndexPredicateAnalyzer analyzer = new IndexPredicateAnalyzer();
    DecomposedPredicate decomposedPredicate = new DecomposedPredicate();
    decomposedPredicate.pushedPredicate =
        analyzer.translateSearchConditions(finalSearchCondition);
    decomposedPredicate.residualPredicate = (ExprNodeGenericFuncDesc) predicate;
    return decomposedPredicate;
  }
}
 
開發者ID:awslabs,項目名稱:emr-dynamodb-connector,代碼行數:20,代碼來源:DynamoDBFilterPushdown.java

示例4: testPredicate_Multiple_1

import org.apache.hadoop.hive.ql.metadata.HiveStoragePredicateHandler.DecomposedPredicate; //導入依賴的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

示例5: testPredicate_Multiple_2

import org.apache.hadoop.hive.ql.metadata.HiveStoragePredicateHandler.DecomposedPredicate; //導入依賴的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

示例6: testPredicate_Multiple_3

import org.apache.hadoop.hive.ql.metadata.HiveStoragePredicateHandler.DecomposedPredicate; //導入依賴的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


注:本文中的org.apache.hadoop.hive.ql.metadata.HiveStoragePredicateHandler.DecomposedPredicate類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。