Repository: hive
Updated Branches:
  refs/heads/branch-3 71d211d2d -> 8c12a11b7


HIVE-19433: HiveJoinPushTransitivePredicatesRule hangs (Vineet Garg,reviewed by 
Jesus Camacho Rodriguez)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/8c12a11b
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/8c12a11b
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/8c12a11b

Branch: refs/heads/branch-3
Commit: 8c12a11b762f5954f75eb35c10cb740dab632554
Parents: 71d211d
Author: Vineet Garg <vg...@apache.org>
Authored: Mon May 14 11:37:05 2018 -0700
Committer: Vineet Garg <vg...@apache.org>
Committed: Mon May 14 11:40:36 2018 -0700

----------------------------------------------------------------------
 .../calcite/stats/HiveRelMdPredicates.java      |   6 +-
 .../queries/clientpositive/infer_join_preds.q   | 222 +++++++
 .../clientpositive/infer_join_preds.q.out       | 594 +++++++++++++++++++
 3 files changed, 820 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/8c12a11b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/HiveRelMdPredicates.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/HiveRelMdPredicates.java
 
b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/HiveRelMdPredicates.java
index 0b1fe74..a137bdf 100644
--- 
a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/HiveRelMdPredicates.java
+++ 
b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/stats/HiveRelMdPredicates.java
@@ -642,7 +642,7 @@ public class HiveRelMdPredicates implements 
MetadataHandler<BuiltInMetadata.Pred
         } else {
           computeNextMapping(iterationIdx.length - 1);
         }
-        return nextMapping != null;
+          return nextMapping != null;
       }
 
       public Mapping next() {
@@ -659,7 +659,9 @@ public class HiveRelMdPredicates implements 
MetadataHandler<BuiltInMetadata.Pred
           if (level == 0) {
             nextMapping = null;
           } else {
-            iterationIdx[level] = 0;
+            int tmp = columnSets[level].nextSetBit(0);
+            nextMapping.set(columns[level], tmp);
+            iterationIdx[level] = tmp + 1;
             computeNextMapping(level - 1);
           }
         } else {

http://git-wip-us.apache.org/repos/asf/hive/blob/8c12a11b/ql/src/test/queries/clientpositive/infer_join_preds.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/infer_join_preds.q 
b/ql/src/test/queries/clientpositive/infer_join_preds.q
index c2e0d09..a9f5468 100644
--- a/ql/src/test/queries/clientpositive/infer_join_preds.q
+++ b/ql/src/test/queries/clientpositive/infer_join_preds.q
@@ -59,3 +59,225 @@ select * from
 (select * from src)a
 right outer join
 (select * from src1 where 1 = 0)b on a.key = b.key;
+
+explain select * from src join src1 on src.key = src1.key and src.value = 
src1.value
+    where 4 between src.key and src.value;
+
+    CREATE TABLE `table1`(
+       `idp_warehouse_id` bigint,
+       `idp_audit_id` bigint,
+       `idp_effective_date` date,
+       `idp_end_date` date,
+       `idp_delete_date` date,
+       `pruid` varchar(32),
+       `prid` bigint,
+       `prtimesheetid` bigint,
+       `prassignmentid` bigint,
+       `prchargecodeid` bigint,
+       `prtypecodeid` bigint,
+       `prsequence` bigint,
+       `prmodby` varchar(96),
+       `prmodtime` timestamp,
+       `prrmexported` bigint,
+       `prrmckdel` bigint,
+       `slice_status` int,
+       `role_id` bigint,
+       `user_lov1` varchar(30),
+       `user_lov2` varchar(30),
+       `incident_id` bigint,
+       `incident_investment_id` bigint,
+       `odf_ss_actuals` bigint,
+       `practsum` decimal(38,20));
+
+    CREATE TABLE `table2`(
+       `idp_warehouse_id` bigint,
+       `idp_audit_id` bigint,
+       `idp_effective_date` date,
+       `idp_end_date` date,
+       `idp_delete_date` date,
+       `pruid` varchar(32),
+       `prid` bigint,
+       `prtimesheetid` bigint,
+       `prassignmentid` bigint,
+       `prchargecodeid` bigint,
+       `prtypecodeid` bigint,
+       `prsequence` bigint,
+       `prmodby` varchar(96),
+       `prmodtime` timestamp,
+       `prrmexported` bigint,
+       `prrmckdel` bigint,
+       `slice_status` int,
+       `role_id` bigint,
+       `user_lov1` varchar(30),
+       `user_lov2` varchar(30),
+       `incident_id` bigint,
+       `incident_investment_id` bigint,
+       `odf_ss_actuals` bigint,
+       `practsum` decimal(38,20));
+
+    explain SELECT          s.idp_warehouse_id AS source_warehouse_id
+    FROM            table1 s
+    JOIN
+
+                           table2 d
+    ON              (
+                                    s.prid = d.prid )
+    JOIN
+                             table2 e
+    ON
+                                    s.prid = e.prid
+    WHERE
+    concat(
+                    CASE
+                                    WHEN s.prid IS NULL THEN 1
+                                    ELSE s.prid
+                    END,',',
+                    CASE
+                                    WHEN s.prtimesheetid IS NULL THEN 1
+                                    ELSE s.prtimesheetid
+                    END,',',
+                    CASE
+                                    WHEN s.prassignmentid IS NULL THEN 1
+                                    ELSE s.prassignmentid
+                    END,',',
+                    CASE
+                                    WHEN s.prchargecodeid IS NULL THEN 1
+                                    ELSE s.prchargecodeid
+                    END,',',
+                    CASE
+                                    WHEN (s.prtypecodeid) IS NULL THEN ''
+                                    ELSE s.prtypecodeid
+                    END,',',
+                    CASE
+                                    WHEN s.practsum IS NULL THEN 1
+                                    ELSE s.practsum
+                    END,',',
+                    CASE
+                                    WHEN s.prsequence IS NULL THEN 1
+                                    ELSE s.prsequence
+                    END,',',
+                    CASE
+                                    WHEN length(s.prmodby) IS NULL THEN ''
+                                    ELSE s.prmodby
+                    END,',',
+                    CASE
+                                    WHEN s.prmodtime IS NULL THEN 
cast(from_unixtime(unix_timestamp('2017-12-08','yyyy-MM-dd') ) AS timestamp)
+                                    ELSE s.prmodtime
+                    END,',',
+                    CASE
+                                    WHEN s.prrmexported IS NULL THEN 1
+                                    ELSE s.prrmexported
+                    END,',',
+                    CASE
+                                    WHEN s.prrmckdel IS NULL THEN 1
+                                    ELSE s.prrmckdel
+                    END,',',
+                    CASE
+                                    WHEN s.slice_status IS NULL THEN 1
+                                    ELSE s.slice_status
+                    END,',',
+                    CASE
+                                    WHEN s.role_id IS NULL THEN 1
+                                    ELSE s.role_id
+                    END,',',
+                    CASE
+                                    WHEN length(s.user_lov1) IS NULL THEN ''
+                                    ELSE s.user_lov1
+                    END,',',
+                    CASE
+                                    WHEN length(s.user_lov2) IS NULL THEN ''
+                                    ELSE s.user_lov2
+                    END,',',
+                    CASE
+                                    WHEN s.incident_id IS NULL THEN 1
+                                    ELSE s.incident_id
+                    END,',',
+                    CASE
+                                    WHEN s.incident_investment_id IS NULL THEN 
1
+                                    ELSE s.incident_investment_id
+                    END,',',
+                    CASE
+                                    WHEN s.odf_ss_actuals IS NULL THEN 1
+                                    ELSE s.odf_ss_actuals
+                    END ) != concat(
+                    CASE
+                                    WHEN length(d.pruid) IS NULL THEN ''
+                                    ELSE d.pruid
+                    END,',',
+                    CASE
+                                    WHEN d.prid IS NULL THEN 1
+                                    ELSE d.prid
+                    END,',',
+                    CASE
+                                    WHEN d.prtimesheetid IS NULL THEN 1
+                                    ELSE d.prtimesheetid
+                    END,',',
+                    CASE
+                                    WHEN d.prassignmentid IS NULL THEN 1
+                                    ELSE d.prassignmentid
+                    END,',',
+                    CASE
+                                    WHEN d.prchargecodeid IS NULL THEN 1
+                                    ELSE d.prchargecodeid
+                    END,',',
+                    CASE
+                                    WHEN (d.prtypecodeid) IS NULL THEN ''
+                                    ELSE d.prtypecodeid
+                    END,',',
+                    CASE
+                                    WHEN d.practsum IS NULL THEN 1
+                                    ELSE d.practsum
+                    END,',',
+                    CASE
+                                    WHEN d.prsequence IS NULL THEN 1
+                                    ELSE d.prsequence
+                    END,',',
+                    CASE
+                                    WHEN length(d.prmodby) IS NULL THEN ''
+                                    ELSE d.prmodby
+                    END,',',
+                    CASE
+                                    WHEN d.prmodtime IS NULL THEN 
cast(from_unixtime(unix_timestamp('2017-12-08','yyyy-MM-dd') ) AS timestamp)
+                                    ELSE d.prmodtime
+                    END,',',
+                    CASE
+                                    WHEN d.prrmexported IS NULL THEN 1
+                                    ELSE d.prrmexported
+                    END,',',
+                    CASE
+                                    WHEN d.prrmckdel IS NULL THEN 1
+                                    ELSE d.prrmckdel
+                    END,',',
+                    CASE
+                                    WHEN d.slice_status IS NULL THEN 1
+                                    ELSE d.slice_status
+                    END,',',
+                    CASE
+                                    WHEN d.role_id IS NULL THEN 1
+                                    ELSE d.role_id
+                    END,',',
+                    CASE
+                                    WHEN length(d.user_lov1) IS NULL THEN ''
+                                    ELSE d.user_lov1
+                    END,',',
+                    CASE
+                                    WHEN length(d.user_lov2) IS NULL THEN ''
+                                    ELSE d.user_lov2
+                    END,',',
+                    CASE
+                                    WHEN d.incident_id IS NULL THEN 1
+                                    ELSE d.incident_id
+                    END,',',
+                    CASE
+                                    WHEN d.incident_investment_id IS NULL THEN 
1
+                                    ELSE d.incident_investment_id
+                    END,',',
+                    CASE
+                                    WHEN d.odf_ss_actuals IS NULL THEN 1
+                                    ELSE d.odf_ss_actuals
+                    END );
+
+drop table table2;
+drop table table1;
+
+

http://git-wip-us.apache.org/repos/asf/hive/blob/8c12a11b/ql/src/test/results/clientpositive/infer_join_preds.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/infer_join_preds.q.out 
b/ql/src/test/results/clientpositive/infer_join_preds.q.out
index 6a4fa34..a35faf3 100644
--- a/ql/src/test/results/clientpositive/infer_join_preds.q.out
+++ b/ql/src/test/results/clientpositive/infer_join_preds.q.out
@@ -607,3 +607,597 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 POSTHOOK: Input: default@src1
 #### A masked pattern was here ####
+PREHOOK: query: explain select * from src join src1 on src.key = src1.key and 
src.value = src1.value
+    where 4 between src.key and src.value
+PREHOOK: type: QUERY
+POSTHOOK: query: explain select * from src join src1 on src.key = src1.key and 
src.value = src1.value
+    where 4 between src.key and src.value
+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: src
+            Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE 
Column stats: NONE
+            Filter Operator
+              predicate: (4.0D BETWEEN UDFToDouble(key) AND UDFToDouble(value) 
and key is not null and value is not null) (type: boolean)
+              Statistics: Num rows: 55 Data size: 584 Basic stats: COMPLETE 
Column stats: NONE
+              Select Operator
+                expressions: key (type: string), value (type: string)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 55 Data size: 584 Basic stats: COMPLETE 
Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: string), _col1 (type: string)
+                  sort order: ++
+                  Map-reduce partition columns: _col0 (type: string), _col1 
(type: string)
+                  Statistics: Num rows: 55 Data size: 584 Basic stats: 
COMPLETE Column stats: NONE
+          TableScan
+            alias: src1
+            Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE 
Column stats: NONE
+            Filter Operator
+              predicate: (4.0D BETWEEN UDFToDouble(key) AND UDFToDouble(value) 
and key is not null and value is not null) (type: boolean)
+              Statistics: Num rows: 2 Data size: 15 Basic stats: COMPLETE 
Column stats: NONE
+              Select Operator
+                expressions: key (type: string), value (type: string)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 2 Data size: 15 Basic stats: COMPLETE 
Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: string), _col1 (type: string)
+                  sort order: ++
+                  Map-reduce partition columns: _col0 (type: string), _col1 
(type: string)
+                  Statistics: Num rows: 2 Data size: 15 Basic stats: COMPLETE 
Column stats: NONE
+      Reduce Operator Tree:
+        Join Operator
+          condition map:
+               Inner Join 0 to 1
+          keys:
+            0 _col0 (type: string), _col1 (type: string)
+            1 _col0 (type: string), _col1 (type: string)
+          outputColumnNames: _col0, _col1, _col2, _col3
+          Statistics: Num rows: 60 Data size: 642 Basic stats: COMPLETE Column 
stats: NONE
+          File Output Operator
+            compressed: false
+            Statistics: Num rows: 60 Data size: 642 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
+
+PREHOOK: query: CREATE TABLE `table1`(
+       `idp_warehouse_id` bigint,
+       `idp_audit_id` bigint,
+       `idp_effective_date` date,
+       `idp_end_date` date,
+       `idp_delete_date` date,
+       `pruid` varchar(32),
+       `prid` bigint,
+       `prtimesheetid` bigint,
+       `prassignmentid` bigint,
+       `prchargecodeid` bigint,
+       `prtypecodeid` bigint,
+       `prsequence` bigint,
+       `prmodby` varchar(96),
+       `prmodtime` timestamp,
+       `prrmexported` bigint,
+       `prrmckdel` bigint,
+       `slice_status` int,
+       `role_id` bigint,
+       `user_lov1` varchar(30),
+       `user_lov2` varchar(30),
+       `incident_id` bigint,
+       `incident_investment_id` bigint,
+       `odf_ss_actuals` bigint,
+       `practsum` decimal(38,20))
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@table1
+POSTHOOK: query: CREATE TABLE `table1`(
+       `idp_warehouse_id` bigint,
+       `idp_audit_id` bigint,
+       `idp_effective_date` date,
+       `idp_end_date` date,
+       `idp_delete_date` date,
+       `pruid` varchar(32),
+       `prid` bigint,
+       `prtimesheetid` bigint,
+       `prassignmentid` bigint,
+       `prchargecodeid` bigint,
+       `prtypecodeid` bigint,
+       `prsequence` bigint,
+       `prmodby` varchar(96),
+       `prmodtime` timestamp,
+       `prrmexported` bigint,
+       `prrmckdel` bigint,
+       `slice_status` int,
+       `role_id` bigint,
+       `user_lov1` varchar(30),
+       `user_lov2` varchar(30),
+       `incident_id` bigint,
+       `incident_investment_id` bigint,
+       `odf_ss_actuals` bigint,
+       `practsum` decimal(38,20))
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@table1
+PREHOOK: query: CREATE TABLE `table2`(
+       `idp_warehouse_id` bigint,
+       `idp_audit_id` bigint,
+       `idp_effective_date` date,
+       `idp_end_date` date,
+       `idp_delete_date` date,
+       `pruid` varchar(32),
+       `prid` bigint,
+       `prtimesheetid` bigint,
+       `prassignmentid` bigint,
+       `prchargecodeid` bigint,
+       `prtypecodeid` bigint,
+       `prsequence` bigint,
+       `prmodby` varchar(96),
+       `prmodtime` timestamp,
+       `prrmexported` bigint,
+       `prrmckdel` bigint,
+       `slice_status` int,
+       `role_id` bigint,
+       `user_lov1` varchar(30),
+       `user_lov2` varchar(30),
+       `incident_id` bigint,
+       `incident_investment_id` bigint,
+       `odf_ss_actuals` bigint,
+       `practsum` decimal(38,20))
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@table2
+POSTHOOK: query: CREATE TABLE `table2`(
+       `idp_warehouse_id` bigint,
+       `idp_audit_id` bigint,
+       `idp_effective_date` date,
+       `idp_end_date` date,
+       `idp_delete_date` date,
+       `pruid` varchar(32),
+       `prid` bigint,
+       `prtimesheetid` bigint,
+       `prassignmentid` bigint,
+       `prchargecodeid` bigint,
+       `prtypecodeid` bigint,
+       `prsequence` bigint,
+       `prmodby` varchar(96),
+       `prmodtime` timestamp,
+       `prrmexported` bigint,
+       `prrmckdel` bigint,
+       `slice_status` int,
+       `role_id` bigint,
+       `user_lov1` varchar(30),
+       `user_lov2` varchar(30),
+       `incident_id` bigint,
+       `incident_investment_id` bigint,
+       `odf_ss_actuals` bigint,
+       `practsum` decimal(38,20))
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@table2
+PREHOOK: query: explain SELECT          s.idp_warehouse_id AS 
source_warehouse_id
+    FROM            table1 s
+    JOIN
+
+                           table2 d
+    ON              (
+                                    s.prid = d.prid )
+    JOIN
+                             table2 e
+    ON
+                                    s.prid = e.prid
+    WHERE
+    concat(
+                    CASE
+                                    WHEN s.prid IS NULL THEN 1
+                                    ELSE s.prid
+                    END,',',
+                    CASE
+                                    WHEN s.prtimesheetid IS NULL THEN 1
+                                    ELSE s.prtimesheetid
+                    END,',',
+                    CASE
+                                    WHEN s.prassignmentid IS NULL THEN 1
+                                    ELSE s.prassignmentid
+                    END,',',
+                    CASE
+                                    WHEN s.prchargecodeid IS NULL THEN 1
+                                    ELSE s.prchargecodeid
+                    END,',',
+                    CASE
+                                    WHEN (s.prtypecodeid) IS NULL THEN ''
+                                    ELSE s.prtypecodeid
+                    END,',',
+                    CASE
+                                    WHEN s.practsum IS NULL THEN 1
+                                    ELSE s.practsum
+                    END,',',
+                    CASE
+                                    WHEN s.prsequence IS NULL THEN 1
+                                    ELSE s.prsequence
+                    END,',',
+                    CASE
+                                    WHEN length(s.prmodby) IS NULL THEN ''
+                                    ELSE s.prmodby
+                    END,',',
+                    CASE
+                                    WHEN s.prmodtime IS NULL THEN 
cast(from_unixtime(unix_timestamp('2017-12-08','yyyy-MM-dd') ) AS timestamp)
+                                    ELSE s.prmodtime
+                    END,',',
+                    CASE
+                                    WHEN s.prrmexported IS NULL THEN 1
+                                    ELSE s.prrmexported
+                    END,',',
+                    CASE
+                                    WHEN s.prrmckdel IS NULL THEN 1
+                                    ELSE s.prrmckdel
+                    END,',',
+                    CASE
+                                    WHEN s.slice_status IS NULL THEN 1
+                                    ELSE s.slice_status
+                    END,',',
+                    CASE
+                                    WHEN s.role_id IS NULL THEN 1
+                                    ELSE s.role_id
+                    END,',',
+                    CASE
+                                    WHEN length(s.user_lov1) IS NULL THEN ''
+                                    ELSE s.user_lov1
+                    END,',',
+                    CASE
+                                    WHEN length(s.user_lov2) IS NULL THEN ''
+                                    ELSE s.user_lov2
+                    END,',',
+                    CASE
+                                    WHEN s.incident_id IS NULL THEN 1
+                                    ELSE s.incident_id
+                    END,',',
+                    CASE
+                                    WHEN s.incident_investment_id IS NULL THEN 
1
+                                    ELSE s.incident_investment_id
+                    END,',',
+                    CASE
+                                    WHEN s.odf_ss_actuals IS NULL THEN 1
+                                    ELSE s.odf_ss_actuals
+                    END ) != concat(
+                    CASE
+                                    WHEN length(d.pruid) IS NULL THEN ''
+                                    ELSE d.pruid
+                    END,',',
+                    CASE
+                                    WHEN d.prid IS NULL THEN 1
+                                    ELSE d.prid
+                    END,',',
+                    CASE
+                                    WHEN d.prtimesheetid IS NULL THEN 1
+                                    ELSE d.prtimesheetid
+                    END,',',
+                    CASE
+                                    WHEN d.prassignmentid IS NULL THEN 1
+                                    ELSE d.prassignmentid
+                    END,',',
+                    CASE
+                                    WHEN d.prchargecodeid IS NULL THEN 1
+                                    ELSE d.prchargecodeid
+                    END,',',
+                    CASE
+                                    WHEN (d.prtypecodeid) IS NULL THEN ''
+                                    ELSE d.prtypecodeid
+                    END,',',
+                    CASE
+                                    WHEN d.practsum IS NULL THEN 1
+                                    ELSE d.practsum
+                    END,',',
+                    CASE
+                                    WHEN d.prsequence IS NULL THEN 1
+                                    ELSE d.prsequence
+                    END,',',
+                    CASE
+                                    WHEN length(d.prmodby) IS NULL THEN ''
+                                    ELSE d.prmodby
+                    END,',',
+                    CASE
+                                    WHEN d.prmodtime IS NULL THEN 
cast(from_unixtime(unix_timestamp('2017-12-08','yyyy-MM-dd') ) AS timestamp)
+                                    ELSE d.prmodtime
+                    END,',',
+                    CASE
+                                    WHEN d.prrmexported IS NULL THEN 1
+                                    ELSE d.prrmexported
+                    END,',',
+                    CASE
+                                    WHEN d.prrmckdel IS NULL THEN 1
+                                    ELSE d.prrmckdel
+                    END,',',
+                    CASE
+                                    WHEN d.slice_status IS NULL THEN 1
+                                    ELSE d.slice_status
+                    END,',',
+                    CASE
+                                    WHEN d.role_id IS NULL THEN 1
+                                    ELSE d.role_id
+                    END,',',
+                    CASE
+                                    WHEN length(d.user_lov1) IS NULL THEN ''
+                                    ELSE d.user_lov1
+                    END,',',
+                    CASE
+                                    WHEN length(d.user_lov2) IS NULL THEN ''
+                                    ELSE d.user_lov2
+                    END,',',
+                    CASE
+                                    WHEN d.incident_id IS NULL THEN 1
+                                    ELSE d.incident_id
+                    END,',',
+                    CASE
+                                    WHEN d.incident_investment_id IS NULL THEN 
1
+                                    ELSE d.incident_investment_id
+                    END,',',
+                    CASE
+                                    WHEN d.odf_ss_actuals IS NULL THEN 1
+                                    ELSE d.odf_ss_actuals
+                    END )
+PREHOOK: type: QUERY
+POSTHOOK: query: explain SELECT          s.idp_warehouse_id AS 
source_warehouse_id
+    FROM            table1 s
+    JOIN
+
+                           table2 d
+    ON              (
+                                    s.prid = d.prid )
+    JOIN
+                             table2 e
+    ON
+                                    s.prid = e.prid
+    WHERE
+    concat(
+                    CASE
+                                    WHEN s.prid IS NULL THEN 1
+                                    ELSE s.prid
+                    END,',',
+                    CASE
+                                    WHEN s.prtimesheetid IS NULL THEN 1
+                                    ELSE s.prtimesheetid
+                    END,',',
+                    CASE
+                                    WHEN s.prassignmentid IS NULL THEN 1
+                                    ELSE s.prassignmentid
+                    END,',',
+                    CASE
+                                    WHEN s.prchargecodeid IS NULL THEN 1
+                                    ELSE s.prchargecodeid
+                    END,',',
+                    CASE
+                                    WHEN (s.prtypecodeid) IS NULL THEN ''
+                                    ELSE s.prtypecodeid
+                    END,',',
+                    CASE
+                                    WHEN s.practsum IS NULL THEN 1
+                                    ELSE s.practsum
+                    END,',',
+                    CASE
+                                    WHEN s.prsequence IS NULL THEN 1
+                                    ELSE s.prsequence
+                    END,',',
+                    CASE
+                                    WHEN length(s.prmodby) IS NULL THEN ''
+                                    ELSE s.prmodby
+                    END,',',
+                    CASE
+                                    WHEN s.prmodtime IS NULL THEN 
cast(from_unixtime(unix_timestamp('2017-12-08','yyyy-MM-dd') ) AS timestamp)
+                                    ELSE s.prmodtime
+                    END,',',
+                    CASE
+                                    WHEN s.prrmexported IS NULL THEN 1
+                                    ELSE s.prrmexported
+                    END,',',
+                    CASE
+                                    WHEN s.prrmckdel IS NULL THEN 1
+                                    ELSE s.prrmckdel
+                    END,',',
+                    CASE
+                                    WHEN s.slice_status IS NULL THEN 1
+                                    ELSE s.slice_status
+                    END,',',
+                    CASE
+                                    WHEN s.role_id IS NULL THEN 1
+                                    ELSE s.role_id
+                    END,',',
+                    CASE
+                                    WHEN length(s.user_lov1) IS NULL THEN ''
+                                    ELSE s.user_lov1
+                    END,',',
+                    CASE
+                                    WHEN length(s.user_lov2) IS NULL THEN ''
+                                    ELSE s.user_lov2
+                    END,',',
+                    CASE
+                                    WHEN s.incident_id IS NULL THEN 1
+                                    ELSE s.incident_id
+                    END,',',
+                    CASE
+                                    WHEN s.incident_investment_id IS NULL THEN 
1
+                                    ELSE s.incident_investment_id
+                    END,',',
+                    CASE
+                                    WHEN s.odf_ss_actuals IS NULL THEN 1
+                                    ELSE s.odf_ss_actuals
+                    END ) != concat(
+                    CASE
+                                    WHEN length(d.pruid) IS NULL THEN ''
+                                    ELSE d.pruid
+                    END,',',
+                    CASE
+                                    WHEN d.prid IS NULL THEN 1
+                                    ELSE d.prid
+                    END,',',
+                    CASE
+                                    WHEN d.prtimesheetid IS NULL THEN 1
+                                    ELSE d.prtimesheetid
+                    END,',',
+                    CASE
+                                    WHEN d.prassignmentid IS NULL THEN 1
+                                    ELSE d.prassignmentid
+                    END,',',
+                    CASE
+                                    WHEN d.prchargecodeid IS NULL THEN 1
+                                    ELSE d.prchargecodeid
+                    END,',',
+                    CASE
+                                    WHEN (d.prtypecodeid) IS NULL THEN ''
+                                    ELSE d.prtypecodeid
+                    END,',',
+                    CASE
+                                    WHEN d.practsum IS NULL THEN 1
+                                    ELSE d.practsum
+                    END,',',
+                    CASE
+                                    WHEN d.prsequence IS NULL THEN 1
+                                    ELSE d.prsequence
+                    END,',',
+                    CASE
+                                    WHEN length(d.prmodby) IS NULL THEN ''
+                                    ELSE d.prmodby
+                    END,',',
+                    CASE
+                                    WHEN d.prmodtime IS NULL THEN 
cast(from_unixtime(unix_timestamp('2017-12-08','yyyy-MM-dd') ) AS timestamp)
+                                    ELSE d.prmodtime
+                    END,',',
+                    CASE
+                                    WHEN d.prrmexported IS NULL THEN 1
+                                    ELSE d.prrmexported
+                    END,',',
+                    CASE
+                                    WHEN d.prrmckdel IS NULL THEN 1
+                                    ELSE d.prrmckdel
+                    END,',',
+                    CASE
+                                    WHEN d.slice_status IS NULL THEN 1
+                                    ELSE d.slice_status
+                    END,',',
+                    CASE
+                                    WHEN d.role_id IS NULL THEN 1
+                                    ELSE d.role_id
+                    END,',',
+                    CASE
+                                    WHEN length(d.user_lov1) IS NULL THEN ''
+                                    ELSE d.user_lov1
+                    END,',',
+                    CASE
+                                    WHEN length(d.user_lov2) IS NULL THEN ''
+                                    ELSE d.user_lov2
+                    END,',',
+                    CASE
+                                    WHEN d.incident_id IS NULL THEN 1
+                                    ELSE d.incident_id
+                    END,',',
+                    CASE
+                                    WHEN d.incident_investment_id IS NULL THEN 
1
+                                    ELSE d.incident_investment_id
+                    END,',',
+                    CASE
+                                    WHEN d.odf_ss_actuals IS NULL THEN 1
+                                    ELSE d.odf_ss_actuals
+                    END )
+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: s
+            Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
+            Filter Operator
+              predicate: prid is not null (type: boolean)
+              Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
+              Reduce Output Operator
+                key expressions: prid (type: bigint)
+                sort order: +
+                Map-reduce partition columns: prid (type: bigint)
+                Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL 
Column stats: NONE
+                value expressions: idp_warehouse_id (type: bigint), 
prtimesheetid (type: bigint), prassignmentid (type: bigint), prchargecodeid 
(type: bigint), prtypecodeid (type: bigint), prsequence (type: bigint), prmodby 
(type: varchar(96)), prmodtime (type: timestamp), prrmexported (type: bigint), 
prrmckdel (type: bigint), slice_status (type: int), role_id (type: bigint), 
user_lov1 (type: varchar(30)), user_lov2 (type: varchar(30)), incident_id 
(type: bigint), incident_investment_id (type: bigint), odf_ss_actuals (type: 
bigint), practsum (type: decimal(38,20))
+          TableScan
+            alias: d
+            Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
+            Filter Operator
+              predicate: prid is not null (type: boolean)
+              Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
+              Reduce Output Operator
+                key expressions: prid (type: bigint)
+                sort order: +
+                Map-reduce partition columns: prid (type: bigint)
+                Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL 
Column stats: NONE
+                value expressions: pruid (type: varchar(32)), prtimesheetid 
(type: bigint), prassignmentid (type: bigint), prchargecodeid (type: bigint), 
prtypecodeid (type: bigint), prsequence (type: bigint), prmodby (type: 
varchar(96)), prmodtime (type: timestamp), prrmexported (type: bigint), 
prrmckdel (type: bigint), slice_status (type: int), role_id (type: bigint), 
user_lov1 (type: varchar(30)), user_lov2 (type: varchar(30)), incident_id 
(type: bigint), incident_investment_id (type: bigint), odf_ss_actuals (type: 
bigint), practsum (type: decimal(38,20))
+          TableScan
+            alias: e
+            Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
+            Filter Operator
+              predicate: prid is not null (type: boolean)
+              Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
+              Reduce Output Operator
+                key expressions: prid (type: bigint)
+                sort order: +
+                Map-reduce partition columns: prid (type: bigint)
+                Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL 
Column stats: NONE
+      Reduce Operator Tree:
+        Join Operator
+          condition map:
+               Inner Join 0 to 1
+               Inner Join 0 to 2
+          keys:
+            0 prid (type: bigint)
+            1 prid (type: bigint)
+            2 prid (type: bigint)
+          outputColumnNames: _col0, _col6, _col7, _col8, _col9, _col10, 
_col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, 
_col21, _col22, _col23, _col32, _col33, _col34, _col35, _col36, _col37, _col38, 
_col39, _col40, _col41, _col42, _col43, _col44, _col45, _col46, _col47, _col48, 
_col49, _col50
+          Statistics: Num rows: 2 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
+          Filter Operator
+            predicate: (concat(CASE WHEN (_col6 is null) THEN (1) ELSE (_col6) 
END, ',', CASE WHEN (_col7 is null) THEN (1) ELSE (_col7) END, ',', CASE WHEN 
(_col8 is null) THEN (1) ELSE (_col8) END, ',', CASE WHEN (_col9 is null) THEN 
(1) ELSE (_col9) END, ',', CASE WHEN (_col10 is null) THEN ('') ELSE (_col10) 
END, ',', CASE WHEN (_col23 is null) THEN (1) ELSE (_col23) END, ',', CASE WHEN 
(_col11 is null) THEN (1) ELSE (_col11) END, ',', CASE WHEN (length(_col12) is 
null) THEN ('') ELSE (_col12) END, ',', CASE WHEN (_col13 is null) THEN 
(TIMESTAMP'2017-12-08 00:00:00.0') ELSE (_col13) END, ',', CASE WHEN (_col14 is 
null) THEN (1) ELSE (_col14) END, ',', CASE WHEN (_col15 is null) THEN (1) ELSE 
(_col15) END, ',', CASE WHEN (_col16 is null) THEN (1) ELSE (_col16) END, ',', 
CASE WHEN (_col17 is null) THEN (1) ELSE (_col17) END, ',', CASE WHEN 
(length(_col18) is null) THEN ('') ELSE (_col18) END, ',', CASE WHEN 
(length(_col19) is null) THEN ('') ELSE (_col19) END, ',', CASE WHEN (_col
 20 is null) THEN (1) ELSE (_col20) END, ',', CASE WHEN (_col21 is null) THEN 
(1) ELSE (_col21) END, ',', CASE WHEN (_col22 is null) THEN (1) ELSE (_col22) 
END) <> concat(CASE WHEN (length(_col32) is null) THEN ('') ELSE (_col32) END, 
',', CASE WHEN (_col33 is null) THEN (1) ELSE (_col33) END, ',', CASE WHEN 
(_col34 is null) THEN (1) ELSE (_col34) END, ',', CASE WHEN (_col35 is null) 
THEN (1) ELSE (_col35) END, ',', CASE WHEN (_col36 is null) THEN (1) ELSE 
(_col36) END, ',', CASE WHEN (_col37 is null) THEN ('') ELSE (_col37) END, ',', 
CASE WHEN (_col50 is null) THEN (1) ELSE (_col50) END, ',', CASE WHEN (_col38 
is null) THEN (1) ELSE (_col38) END, ',', CASE WHEN (length(_col39) is null) 
THEN ('') ELSE (_col39) END, ',', CASE WHEN (_col40 is null) THEN 
(TIMESTAMP'2017-12-08 00:00:00.0') ELSE (_col40) END, ',', CASE WHEN (_col41 is 
null) THEN (1) ELSE (_col41) END, ',', CASE WHEN (_col42 is null) THEN (1) ELSE 
(_col42) END, ',', CASE WHEN (_col43 is null) THEN (1) ELSE (_col43) END, ',
 ', CASE WHEN (_col44 is null) THEN (1) ELSE (_col44) END, ',', CASE WHEN 
(length(_col45) is null) THEN ('') ELSE (_col45) END, ',', CASE WHEN 
(length(_col46) is null) THEN ('') ELSE (_col46) END, ',', CASE WHEN (_col47 is 
null) THEN (1) ELSE (_col47) END, ',', CASE WHEN (_col48 is null) THEN (1) ELSE 
(_col48) END, ',', CASE WHEN (_col49 is null) THEN (1) ELSE (_col49) END)) 
(type: boolean)
+            Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
+            Select Operator
+              expressions: _col0 (type: bigint)
+              outputColumnNames: _col0
+              Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column 
stats: NONE
+              File Output Operator
+                compressed: false
+                Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL 
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
+
+PREHOOK: query: drop table table2
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: default@table2
+PREHOOK: Output: default@table2
+POSTHOOK: query: drop table table2
+POSTHOOK: type: DROPTABLE
+POSTHOOK: Input: default@table2
+POSTHOOK: Output: default@table2
+PREHOOK: query: drop table table1
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: default@table1
+PREHOOK: Output: default@table1
+POSTHOOK: query: drop table table1
+POSTHOOK: type: DROPTABLE
+POSTHOOK: Input: default@table1
+POSTHOOK: Output: default@table1

Reply via email to