Repository: hive Updated Branches: refs/heads/master 18779ea07 -> 0808f7d32
HIVE-18660 : PCR doesn't distinguish between partition and virtual columns (Ashutosh Chauhan via Gopal V, Jesus Camacho Rodriguez) Signed-off-by: Ashutosh Chauhan <hashut...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/0808f7d3 Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/0808f7d3 Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/0808f7d3 Branch: refs/heads/master Commit: 0808f7d328fe38be27efc78f3a43a0fbd5b2a1e3 Parents: 18779ea Author: Ashutosh Chauhan <hashut...@apache.org> Authored: Mon Feb 12 14:57:49 2018 -0800 Committer: Ashutosh Chauhan <hashut...@apache.org> Committed: Mon Feb 12 14:57:49 2018 -0800 ---------------------------------------------------------------------- .../ql/optimizer/pcr/PcrExprProcFactory.java | 3 +- .../queries/clientpositive/partition_boolexpr.q | 3 +- .../clientpositive/partition_boolexpr.q.out | 49 ++++++++++++++++++++ 3 files changed, 53 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/0808f7d3/ql/src/java/org/apache/hadoop/hive/ql/optimizer/pcr/PcrExprProcFactory.java ---------------------------------------------------------------------- diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/pcr/PcrExprProcFactory.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/pcr/PcrExprProcFactory.java index ea042bf..f612cd2 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/pcr/PcrExprProcFactory.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/pcr/PcrExprProcFactory.java @@ -214,7 +214,8 @@ public final class PcrExprProcFactory { ExprNodeColumnDesc cd = (ExprNodeColumnDesc) nd; PcrExprProcCtx epc = (PcrExprProcCtx) procCtx; if (cd.getTabAlias().equalsIgnoreCase(epc.getTabAlias()) - && cd.getIsPartitionColOrVirtualCol()) { + && cd.getIsPartitionColOrVirtualCol() + && !VirtualColumn.VIRTUAL_COLUMN_NAMES.contains(cd.getColumn().toUpperCase())) { return new NodeInfoWrapper(WalkState.PART_COL, null, cd); } else { return new NodeInfoWrapper(WalkState.UNKNOWN, null, cd); http://git-wip-us.apache.org/repos/asf/hive/blob/0808f7d3/ql/src/test/queries/clientpositive/partition_boolexpr.q ---------------------------------------------------------------------- diff --git a/ql/src/test/queries/clientpositive/partition_boolexpr.q b/ql/src/test/queries/clientpositive/partition_boolexpr.q index e18f095..6178aab 100644 --- a/ql/src/test/queries/clientpositive/partition_boolexpr.q +++ b/ql/src/test/queries/clientpositive/partition_boolexpr.q @@ -10,4 +10,5 @@ explain select count(1) from srcpart where false; explain select count(1) from srcpart where true and hr='11'; explain select count(1) from srcpart where true or hr='11'; explain select count(1) from srcpart where false or hr='11'; -explain select count(1) from srcpart where false and hr='11'; \ No newline at end of file +explain select count(1) from srcpart where false and hr='11'; +explain select count(1) from srcpart where INPUT__FILE__NAME is not null; http://git-wip-us.apache.org/repos/asf/hive/blob/0808f7d3/ql/src/test/results/clientpositive/partition_boolexpr.q.out ---------------------------------------------------------------------- diff --git a/ql/src/test/results/clientpositive/partition_boolexpr.q.out b/ql/src/test/results/clientpositive/partition_boolexpr.q.out index b605260..3276a30 100644 --- a/ql/src/test/results/clientpositive/partition_boolexpr.q.out +++ b/ql/src/test/results/clientpositive/partition_boolexpr.q.out @@ -177,3 +177,52 @@ STAGE PLANS: Processor Tree: ListSink +PREHOOK: query: explain select count(1) from srcpart where INPUT__FILE__NAME is not null +PREHOOK: type: QUERY +POSTHOOK: query: explain select count(1) from srcpart where INPUT__FILE__NAME is not null +POSTHOOK: type: QUERY +STAGE DEPENDENCIES: + Stage-1 is a root stage + Stage-0 depends on stages: Stage-1 + +STAGE PLANS: + Stage: Stage-1 + Map Reduce + Map Operator Tree: + TableScan + alias: srcpart + Statistics: Num rows: 2000 Data size: 21248 Basic stats: COMPLETE Column stats: NONE + Filter Operator + predicate: INPUT__FILE__NAME is not null (type: boolean) + Statistics: Num rows: 2000 Data size: 21248 Basic stats: COMPLETE Column stats: NONE + Select Operator + Statistics: Num rows: 2000 Data size: 21248 Basic stats: COMPLETE Column stats: NONE + Group By Operator + aggregations: count() + mode: hash + outputColumnNames: _col0 + Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE + Reduce Output Operator + sort order: + Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE + value expressions: _col0 (type: bigint) + Reduce Operator Tree: + Group By Operator + aggregations: count(VALUE._col0) + mode: mergepartial + outputColumnNames: _col0 + Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE + File Output Operator + compressed: false + Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE + table: + input format: org.apache.hadoop.mapred.SequenceFileInputFormat + output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat + serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe + + Stage: Stage-0 + Fetch Operator + limit: -1 + Processor Tree: + ListSink +