diff --git ql/src/java/org/apache/hadoop/hive/ql/plan/ExprNodeDescUtils.java ql/src/java/org/apache/hadoop/hive/ql/plan/ExprNodeDescUtils.java index 0223038..2383af5 100644 --- ql/src/java/org/apache/hadoop/hive/ql/plan/ExprNodeDescUtils.java +++ ql/src/java/org/apache/hadoop/hive/ql/plan/ExprNodeDescUtils.java @@ -109,9 +109,17 @@ public static boolean containsPredicate(ExprNodeDesc source, ExprNodeDesc predic * bind two predicates by AND op */ public static ExprNodeGenericFuncDesc mergePredicates(ExprNodeDesc prev, ExprNodeDesc next) { - List children = new ArrayList(2); - children.add(prev); - children.add(next); + final List children = new ArrayList(2); + if (FunctionRegistry.isOpAnd(prev)) { + children.addAll(prev.getChildren()); + } else { + children.add(prev); + } + if (FunctionRegistry.isOpAnd(next)) { + children.addAll(next.getChildren()); + } else { + children.add(next); + } return new ExprNodeGenericFuncDesc(TypeInfoFactory.booleanTypeInfo, FunctionRegistry.getGenericUDFForAnd(), children); } diff --git ql/src/test/results/clientpositive/tez/tez_dynpart_hashjoin_1.q.out ql/src/test/results/clientpositive/tez/tez_dynpart_hashjoin_1.q.out index e3131d5..2863569 100644 --- ql/src/test/results/clientpositive/tez/tez_dynpart_hashjoin_1.q.out +++ ql/src/test/results/clientpositive/tez/tez_dynpart_hashjoin_1.q.out @@ -34,7 +34,7 @@ STAGE PLANS: alias: a Statistics: Num rows: 12288 Data size: 2641964 Basic stats: COMPLETE Column stats: NONE Filter Operator - predicate: (cint BETWEEN 1000000 AND 3000000 and cint is not null) (type: boolean) + predicate: (cint is not null and cint BETWEEN 1000000 AND 3000000) (type: boolean) Statistics: Num rows: 6144 Data size: 1320982 Basic stats: COMPLETE Column stats: NONE Select Operator expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean) @@ -52,7 +52,7 @@ STAGE PLANS: alias: a Statistics: Num rows: 12288 Data size: 2641964 Basic stats: COMPLETE Column stats: NONE Filter Operator - predicate: ((cbigint is not null and cint BETWEEN 1000000 AND 3000000) and cint is not null) (type: boolean) + predicate: (cbigint is not null and cint is not null and cint BETWEEN 1000000 AND 3000000) (type: boolean) Statistics: Num rows: 6144 Data size: 1320982 Basic stats: COMPLETE Column stats: NONE Select Operator expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean) @@ -159,7 +159,7 @@ STAGE PLANS: alias: a Statistics: Num rows: 12288 Data size: 2641964 Basic stats: COMPLETE Column stats: NONE Filter Operator - predicate: (cint BETWEEN 1000000 AND 3000000 and cint is not null) (type: boolean) + predicate: (cint is not null and cint BETWEEN 1000000 AND 3000000) (type: boolean) Statistics: Num rows: 6144 Data size: 1320982 Basic stats: COMPLETE Column stats: NONE Select Operator expressions: cint (type: int) @@ -176,7 +176,7 @@ STAGE PLANS: alias: a Statistics: Num rows: 12288 Data size: 2641964 Basic stats: COMPLETE Column stats: NONE Filter Operator - predicate: ((cbigint is not null and cint BETWEEN 1000000 AND 3000000) and cint is not null) (type: boolean) + predicate: (cbigint is not null and cint is not null and cint BETWEEN 1000000 AND 3000000) (type: boolean) Statistics: Num rows: 6144 Data size: 1320982 Basic stats: COMPLETE Column stats: NONE Select Operator expressions: cint (type: int) @@ -280,7 +280,7 @@ STAGE PLANS: alias: a Statistics: Num rows: 12288 Data size: 2641964 Basic stats: COMPLETE Column stats: NONE Filter Operator - predicate: (cint BETWEEN 1000000 AND 3000000 and cint is not null) (type: boolean) + predicate: (cint is not null and cint BETWEEN 1000000 AND 3000000) (type: boolean) Statistics: Num rows: 6144 Data size: 1320982 Basic stats: COMPLETE Column stats: NONE Select Operator expressions: csmallint (type: smallint), cint (type: int) @@ -298,7 +298,7 @@ STAGE PLANS: alias: a Statistics: Num rows: 12288 Data size: 2641964 Basic stats: COMPLETE Column stats: NONE Filter Operator - predicate: ((cbigint is not null and cint BETWEEN 1000000 AND 3000000) and cint is not null) (type: boolean) + predicate: (cbigint is not null and cint is not null and cint BETWEEN 1000000 AND 3000000) (type: boolean) Statistics: Num rows: 6144 Data size: 1320982 Basic stats: COMPLETE Column stats: NONE Select Operator expressions: cint (type: int) @@ -425,7 +425,7 @@ STAGE PLANS: alias: a Statistics: Num rows: 12288 Data size: 2641964 Basic stats: COMPLETE Column stats: NONE Filter Operator - predicate: (cint BETWEEN 1000000 AND 3000000 and cint is not null) (type: boolean) + predicate: (cint is not null and cint BETWEEN 1000000 AND 3000000) (type: boolean) Statistics: Num rows: 6144 Data size: 1320982 Basic stats: COMPLETE Column stats: NONE Select Operator expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean) @@ -443,7 +443,7 @@ STAGE PLANS: alias: a Statistics: Num rows: 12288 Data size: 2641964 Basic stats: COMPLETE Column stats: NONE Filter Operator - predicate: ((cbigint is not null and cint BETWEEN 1000000 AND 3000000) and cint is not null) (type: boolean) + predicate: (cbigint is not null and cint is not null and cint BETWEEN 1000000 AND 3000000) (type: boolean) Statistics: Num rows: 6144 Data size: 1320982 Basic stats: COMPLETE Column stats: NONE Select Operator expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean) @@ -553,7 +553,7 @@ STAGE PLANS: alias: a Statistics: Num rows: 12288 Data size: 2641964 Basic stats: COMPLETE Column stats: NONE Filter Operator - predicate: (cint BETWEEN 1000000 AND 3000000 and cint is not null) (type: boolean) + predicate: (cint is not null and cint BETWEEN 1000000 AND 3000000) (type: boolean) Statistics: Num rows: 6144 Data size: 1320982 Basic stats: COMPLETE Column stats: NONE Select Operator expressions: cint (type: int) @@ -570,7 +570,7 @@ STAGE PLANS: alias: a Statistics: Num rows: 12288 Data size: 2641964 Basic stats: COMPLETE Column stats: NONE Filter Operator - predicate: ((cbigint is not null and cint BETWEEN 1000000 AND 3000000) and cint is not null) (type: boolean) + predicate: (cbigint is not null and cint is not null and cint BETWEEN 1000000 AND 3000000) (type: boolean) Statistics: Num rows: 6144 Data size: 1320982 Basic stats: COMPLETE Column stats: NONE Select Operator expressions: cint (type: int) @@ -677,7 +677,7 @@ STAGE PLANS: alias: a Statistics: Num rows: 12288 Data size: 2641964 Basic stats: COMPLETE Column stats: NONE Filter Operator - predicate: (cint BETWEEN 1000000 AND 3000000 and cint is not null) (type: boolean) + predicate: (cint is not null and cint BETWEEN 1000000 AND 3000000) (type: boolean) Statistics: Num rows: 6144 Data size: 1320982 Basic stats: COMPLETE Column stats: NONE Select Operator expressions: csmallint (type: smallint), cint (type: int) @@ -695,7 +695,7 @@ STAGE PLANS: alias: a Statistics: Num rows: 12288 Data size: 2641964 Basic stats: COMPLETE Column stats: NONE Filter Operator - predicate: ((cbigint is not null and cint BETWEEN 1000000 AND 3000000) and cint is not null) (type: boolean) + predicate: (cbigint is not null and cint is not null and cint BETWEEN 1000000 AND 3000000) (type: boolean) Statistics: Num rows: 6144 Data size: 1320982 Basic stats: COMPLETE Column stats: NONE Select Operator expressions: cint (type: int)