You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2014/09/25 18:51:31 UTC
svn commit: r1627571 - in /hive/trunk/ql/src:
java/org/apache/hadoop/hive/ql/optimizer/optiq/rules/PartitionPruner.java
java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
test/results/clientpositive/tez/cbo_correctness.q.out
Author: hashutosh
Date: Thu Sep 25 16:51:30 2014
New Revision: 1627571
URL: http://svn.apache.org/r1627571
Log:
HIVE-8228 : CBO: fix couple of issues with partition pruning (Harish Butani via Ashutosh Chauhan)
Modified:
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/rules/PartitionPruner.java
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
hive/trunk/ql/src/test/results/clientpositive/tez/cbo_correctness.q.out
Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/rules/PartitionPruner.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/rules/PartitionPruner.java?rev=1627571&r1=1627570&r2=1627571&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/rules/PartitionPruner.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/optimizer/optiq/rules/PartitionPruner.java Thu Sep 25 16:51:30 2014
@@ -24,7 +24,10 @@ import java.util.List;
import java.util.Set;
import org.apache.hadoop.hive.metastore.api.FieldSchema;
+import org.apache.hadoop.hive.ql.exec.FunctionRegistry;
import org.apache.hadoop.hive.ql.optimizer.optiq.RelOptHiveTable;
+import org.apache.hadoop.hive.ql.optimizer.optiq.translator.SqlFunctionConverter;
+import org.apache.hadoop.hive.ql.udf.generic.GenericUDF;
import org.eigenbase.relopt.RelOptCluster;
import org.eigenbase.reltype.RelDataType;
import org.eigenbase.reltype.RelDataTypeField;
@@ -104,6 +107,13 @@ public class PartitionPruner {
List<RexNode> args = new LinkedList<RexNode>();
boolean argsPruned = false;
+ GenericUDF hiveUDF = SqlFunctionConverter.getHiveUDF(call.getOperator(),
+ call.getType());
+ if (hiveUDF != null &&
+ !FunctionRegistry.isDeterministic(hiveUDF)) {
+ return null;
+ }
+
for (RexNode operand : call.operands) {
RexNode n = operand.accept(this);
if (n != null) {
Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java?rev=1627571&r1=1627570&r2=1627571&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java Thu Sep 25 16:51:30 2014
@@ -12292,6 +12292,11 @@ public class SemanticAnalyzer extends Ba
HiveSortRel.HIVE_SORT_REL_FACTORY, HiveAggregateRel.HIVE_AGGR_REL_FACTORY, HiveUnionRel.UNION_REL_FACTORY);
basePlan = fieldTrimmer.trim(basePlan);
+ basePlan = hepPlan(basePlan, true, mdProvider,
+ new PushFilterPastProjectRule(FilterRelBase.class,
+ HiveFilterRel.DEFAULT_FILTER_FACTORY, HiveProjectRel.class,
+ HiveProjectRel.DEFAULT_PROJECT_FACTORY));
+
return basePlan;
}
Modified: hive/trunk/ql/src/test/results/clientpositive/tez/cbo_correctness.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/tez/cbo_correctness.q.out?rev=1627571&r1=1627570&r2=1627571&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/tez/cbo_correctness.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/tez/cbo_correctness.q.out Thu Sep 25 16:51:30 2014
@@ -16734,26 +16734,6 @@ POSTHOOK: Input: default@t1@dt=2014
POSTHOOK: Input: default@t2
POSTHOOK: Input: default@t2@dt=2014
#### A masked pattern was here ####
-1 1 1 1.0 true 2014
-1 1 1 1.0 true 2014
-1 1 1 1.0 true 2014
-1 1 1 1.0 true 2014
-1 1 1 1.0 true 2014
-1 1 1 1.0 true 2014
-1 1 1 1.0 true 2014
-1 1 1 1.0 true 2014
-1 1 1 1.0 true 2014
-1 1 1 1.0 true 2014
- 1 1 1 1.0 true 2014
- 1 1 1 1.0 true 2014
- 1 1 1 1.0 true 2014
- 1 1 1 1.0 true 2014
-1 1 1 1.0 true 2014
-1 1 1 1.0 true 2014
-1 1 1 1.0 false 2014
-1 1 1 1.0 false 2014
-null null NULL NULL NULL 2014
-null null NULL NULL NULL 2014
1 1 1 1.0 true 2014
1 1 1 1.0 true 2014
1 1 1 1.0 true 2014
@@ -16774,6 +16754,26 @@ null null NULL NULL NULL 2014
2 2 2 2.0 true 2014
null null NULL NULL NULL 2014
null null NULL NULL NULL 2014
+1 1 1 1.0 true 2014
+1 1 1 1.0 true 2014
+1 1 1 1.0 true 2014
+1 1 1 1.0 true 2014
+1 1 1 1.0 true 2014
+1 1 1 1.0 true 2014
+1 1 1 1.0 true 2014
+1 1 1 1.0 true 2014
+1 1 1 1.0 true 2014
+1 1 1 1.0 true 2014
+ 1 1 1 1.0 true 2014
+ 1 1 1 1.0 true 2014
+ 1 1 1 1.0 true 2014
+ 1 1 1 1.0 true 2014
+1 1 1 1.0 true 2014
+1 1 1 1.0 true 2014
+1 1 1 1.0 false 2014
+1 1 1 1.0 false 2014
+null null NULL NULL NULL 2014
+null null NULL NULL NULL 2014
PREHOOK: query: select key from (select key, c_int from (select * from t1 union all select * from t2 where t2.key >=0)r1 union all select key, c_int from t3)r2 where key >=0 order by key
PREHOOK: type: QUERY
PREHOOK: Input: default@t1