[hive] 01/02: HIVE-21613: Queries with join condition having timestamp or timestamp with local time zone literal throw SemanticException (Jesus Camacho Rodriguez, reviewed by Sankar Hariappan)

2019-04-15 Thread jcamacho
This is an automated email from the ASF dual-hosted git repository.

jcamacho pushed a commit to branch branch-3
in repository https://gitbox.apache.org/repos/asf/hive.git

commit 41b65fd48fd51b3e460de23c23637e6b4d43e95d
Author: Jesus Camacho Rodriguez 
AuthorDate: Fri Apr 12 20:12:04 2019 -0700

HIVE-21613: Queries with join condition having timestamp or timestamp with 
local time zone literal throw SemanticException (Jesus Camacho Rodriguez, 
reviewed by Sankar Hariappan)
---
 .../test/resources/testconfiguration.properties|  2 +
 .../hadoop/hive/ql/parse/SemanticAnalyzer.java |  2 +
 ql/src/test/queries/clientpositive/timestamp_4.q   | 15 ++
 ql/src/test/queries/clientpositive/timestamptz_5.q | 16 ++
 .../results/clientpositive/llap/timestamp_4.q.out  | 58 ++
 .../clientpositive/llap/timestamptz_5.q.out| 57 +
 6 files changed, 150 insertions(+)

diff --git a/itests/src/test/resources/testconfiguration.properties 
b/itests/src/test/resources/testconfiguration.properties
index f09bf14..2504f53 100644
--- a/itests/src/test/resources/testconfiguration.properties
+++ b/itests/src/test/resources/testconfiguration.properties
@@ -758,6 +758,8 @@ minillaplocal.query.files=\
   tez_union_multiinsert.q,\
   tez_vector_dynpart_hashjoin_1.q,\
   tez_vector_dynpart_hashjoin_2.q,\
+  timestamp_4.q,\
+  timestamptz_5.q,\
   uber_reduce.q,\
   udaf_collect_set_2.q,\
   udaf_all_keyword.q,\
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java 
b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
index 013cefc..ff9a71b 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
@@ -2754,6 +2754,8 @@ public class SemanticAnalyzer extends 
BaseSemanticAnalyzer {
 case HiveParser.KW_TRUE:
 case HiveParser.KW_FALSE:
 case HiveParser.TOK_DATELITERAL:
+case HiveParser.TOK_TIMESTAMPLITERAL:
+case HiveParser.TOK_TIMESTAMPLOCALTZLITERAL:
   break;
 
 case HiveParser.TOK_FUNCTION:
diff --git a/ql/src/test/queries/clientpositive/timestamp_4.q 
b/ql/src/test/queries/clientpositive/timestamp_4.q
new file mode 100644
index 000..b7a6dcc
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/timestamp_4.q
@@ -0,0 +1,15 @@
+drop table if exists timestamp_1;
+drop table if exists timestamp_2;
+
+create table timestamp_1 (key int, dd timestamp);
+create table timestamp_2 (key int, dd timestamp);
+
+-- between clause with timestamp literal in join condition
+select d1.key, d2.dd
+  from (select key, dd as start_dd, current_timestamp as end_dd from 
timestamp_1) d1
+  join timestamp_2 as d2
+on d1.key = d2.key
+where d2.dd between start_dd and end_dd;
+
+drop table timestamp_1;
+drop table timestamp_2;
\ No newline at end of file
diff --git a/ql/src/test/queries/clientpositive/timestamptz_5.q 
b/ql/src/test/queries/clientpositive/timestamptz_5.q
new file mode 100644
index 000..d1e15ee
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/timestamptz_5.q
@@ -0,0 +1,16 @@
+set hive.cbo.enable=false;
+
+drop table if exists timestamplocaltz_n1;
+drop table if exists timestamplocaltz_n2;
+
+create table timestamplocaltz_n1 (key int, dd timestamp with local time zone);
+create table timestamplocaltz_n2 (key int, dd timestamp with local time zone);
+
+-- between clause with timestamp literal in join condition
+select d1.key, d2.dd
+  from (select key, dd as start_dd, current_timestamp as end_dd from 
timestamplocaltz_n1) d1
+  join timestamplocaltz_n2 as d2
+on d1.key = d2.key or d2.dd between timestamplocaltz '2010-04-01 00:00:00 
America/Los_Angeles' and timestamplocaltz '2010-04-02 00:00:00 
America/Los_Angeles';
+
+drop table timestamplocaltz_n1;
+drop table timestamplocaltz_n2;
\ No newline at end of file
diff --git a/ql/src/test/results/clientpositive/llap/timestamp_4.q.out 
b/ql/src/test/results/clientpositive/llap/timestamp_4.q.out
new file mode 100644
index 000..54864de
--- /dev/null
+++ b/ql/src/test/results/clientpositive/llap/timestamp_4.q.out
@@ -0,0 +1,58 @@
+PREHOOK: query: drop table if exists timestamp_1
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: drop table if exists timestamp_1
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: drop table if exists timestamp_2
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: drop table if exists timestamp_2
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: create table timestamp_1 (key int, dd timestamp)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@timestamp_1
+POSTHOOK: query: create table timestamp_1 (key int, dd timestamp)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@timestamp_1
+PREHOOK: query: create table timestamp_2 (key int, dd timestamp)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@timestamp_2
+POSTHOOK: query: create table 

[hive] 01/02: HIVE-21613: Queries with join condition having timestamp or timestamp with local time zone literal throw SemanticException (Jesus Camacho Rodriguez, reviewed by Sankar Hariappan)

2019-04-15 Thread jcamacho
This is an automated email from the ASF dual-hosted git repository.

jcamacho pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/hive.git

commit 560016b82d37775c090ef3f80ac92fe36c601b69
Author: Jesus Camacho Rodriguez 
AuthorDate: Fri Apr 12 20:12:04 2019 -0700

HIVE-21613: Queries with join condition having timestamp or timestamp with 
local time zone literal throw SemanticException (Jesus Camacho Rodriguez, 
reviewed by Sankar Hariappan)
---
 .../test/resources/testconfiguration.properties|  2 +
 .../hadoop/hive/ql/parse/SemanticAnalyzer.java |  2 +
 ql/src/test/queries/clientpositive/timestamp_4.q   | 15 ++
 ql/src/test/queries/clientpositive/timestamptz_5.q | 16 ++
 .../results/clientpositive/llap/timestamp_4.q.out  | 58 ++
 .../clientpositive/llap/timestamptz_5.q.out| 57 +
 6 files changed, 150 insertions(+)

diff --git a/itests/src/test/resources/testconfiguration.properties 
b/itests/src/test/resources/testconfiguration.properties
index c217b9b..52cca0c 100644
--- a/itests/src/test/resources/testconfiguration.properties
+++ b/itests/src/test/resources/testconfiguration.properties
@@ -738,6 +738,8 @@ minillaplocal.query.files=\
   tez_union_multiinsert.q,\
   tez_vector_dynpart_hashjoin_1.q,\
   tez_vector_dynpart_hashjoin_2.q,\
+  timestamp_4.q,\
+  timestamptz_5.q,\
   uber_reduce.q,\
   udaf_collect_set_2.q,\
   udaf_all_keyword.q,\
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java 
b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
index 9d7d793..f8a4e11 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
@@ -2732,6 +2732,8 @@ public class SemanticAnalyzer extends 
BaseSemanticAnalyzer {
 case HiveParser.KW_TRUE:
 case HiveParser.KW_FALSE:
 case HiveParser.TOK_DATELITERAL:
+case HiveParser.TOK_TIMESTAMPLITERAL:
+case HiveParser.TOK_TIMESTAMPLOCALTZLITERAL:
   break;
 
 case HiveParser.TOK_FUNCTION:
diff --git a/ql/src/test/queries/clientpositive/timestamp_4.q 
b/ql/src/test/queries/clientpositive/timestamp_4.q
new file mode 100644
index 000..b7a6dcc
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/timestamp_4.q
@@ -0,0 +1,15 @@
+drop table if exists timestamp_1;
+drop table if exists timestamp_2;
+
+create table timestamp_1 (key int, dd timestamp);
+create table timestamp_2 (key int, dd timestamp);
+
+-- between clause with timestamp literal in join condition
+select d1.key, d2.dd
+  from (select key, dd as start_dd, current_timestamp as end_dd from 
timestamp_1) d1
+  join timestamp_2 as d2
+on d1.key = d2.key
+where d2.dd between start_dd and end_dd;
+
+drop table timestamp_1;
+drop table timestamp_2;
\ No newline at end of file
diff --git a/ql/src/test/queries/clientpositive/timestamptz_5.q 
b/ql/src/test/queries/clientpositive/timestamptz_5.q
new file mode 100644
index 000..d1e15ee
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/timestamptz_5.q
@@ -0,0 +1,16 @@
+set hive.cbo.enable=false;
+
+drop table if exists timestamplocaltz_n1;
+drop table if exists timestamplocaltz_n2;
+
+create table timestamplocaltz_n1 (key int, dd timestamp with local time zone);
+create table timestamplocaltz_n2 (key int, dd timestamp with local time zone);
+
+-- between clause with timestamp literal in join condition
+select d1.key, d2.dd
+  from (select key, dd as start_dd, current_timestamp as end_dd from 
timestamplocaltz_n1) d1
+  join timestamplocaltz_n2 as d2
+on d1.key = d2.key or d2.dd between timestamplocaltz '2010-04-01 00:00:00 
America/Los_Angeles' and timestamplocaltz '2010-04-02 00:00:00 
America/Los_Angeles';
+
+drop table timestamplocaltz_n1;
+drop table timestamplocaltz_n2;
\ No newline at end of file
diff --git a/ql/src/test/results/clientpositive/llap/timestamp_4.q.out 
b/ql/src/test/results/clientpositive/llap/timestamp_4.q.out
new file mode 100644
index 000..54864de
--- /dev/null
+++ b/ql/src/test/results/clientpositive/llap/timestamp_4.q.out
@@ -0,0 +1,58 @@
+PREHOOK: query: drop table if exists timestamp_1
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: drop table if exists timestamp_1
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: drop table if exists timestamp_2
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: drop table if exists timestamp_2
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: create table timestamp_1 (key int, dd timestamp)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@timestamp_1
+POSTHOOK: query: create table timestamp_1 (key int, dd timestamp)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@timestamp_1
+PREHOOK: query: create table timestamp_2 (key int, dd timestamp)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@timestamp_2
+POSTHOOK: query: create 

[hive] 01/02: HIVE-21613: Queries with join condition having timestamp or timestamp with local time zone literal throw SemanticException (Jesus Camacho Rodriguez, reviewed by Sankar Hariappan)

2019-04-15 Thread jcamacho
This is an automated email from the ASF dual-hosted git repository.

jcamacho pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git

commit d200cb34b99cc24c5a971f3937ba8b407cffcae9
Author: Jesus Camacho Rodriguez 
AuthorDate: Fri Apr 12 20:12:04 2019 -0700

HIVE-21613: Queries with join condition having timestamp or timestamp with 
local time zone literal throw SemanticException (Jesus Camacho Rodriguez, 
reviewed by Sankar Hariappan)
---
 .../test/resources/testconfiguration.properties|  2 +
 .../hadoop/hive/ql/parse/SemanticAnalyzer.java |  2 +
 ql/src/test/queries/clientpositive/timestamp_4.q   | 15 ++
 ql/src/test/queries/clientpositive/timestamptz_5.q | 16 ++
 .../results/clientpositive/llap/timestamp_4.q.out  | 58 ++
 .../clientpositive/llap/timestamptz_5.q.out| 57 +
 6 files changed, 150 insertions(+)

diff --git a/itests/src/test/resources/testconfiguration.properties 
b/itests/src/test/resources/testconfiguration.properties
index 06b59a7..4a4cca7 100644
--- a/itests/src/test/resources/testconfiguration.properties
+++ b/itests/src/test/resources/testconfiguration.properties
@@ -774,6 +774,8 @@ minillaplocal.query.files=\
   tez_union_multiinsert.q,\
   tez_vector_dynpart_hashjoin_1.q,\
   tez_vector_dynpart_hashjoin_2.q,\
+  timestamp_4.q,\
+  timestamptz_5.q,\
   transitive_not_null.q,\
   truncate_external_force.q,\
   uber_reduce.q,\
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java 
b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
index 73ae3ba..f89e8f8 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
@@ -2712,6 +2712,8 @@ public class SemanticAnalyzer extends 
BaseSemanticAnalyzer {
 case HiveParser.KW_TRUE:
 case HiveParser.KW_FALSE:
 case HiveParser.TOK_DATELITERAL:
+case HiveParser.TOK_TIMESTAMPLITERAL:
+case HiveParser.TOK_TIMESTAMPLOCALTZLITERAL:
 case HiveParser.TOK_INTERVAL_DAY_LITERAL:
 case HiveParser.TOK_INTERVAL_DAY_TIME:
 case HiveParser.TOK_INTERVAL_DAY_TIME_LITERAL:
diff --git a/ql/src/test/queries/clientpositive/timestamp_4.q 
b/ql/src/test/queries/clientpositive/timestamp_4.q
new file mode 100644
index 000..b7a6dcc
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/timestamp_4.q
@@ -0,0 +1,15 @@
+drop table if exists timestamp_1;
+drop table if exists timestamp_2;
+
+create table timestamp_1 (key int, dd timestamp);
+create table timestamp_2 (key int, dd timestamp);
+
+-- between clause with timestamp literal in join condition
+select d1.key, d2.dd
+  from (select key, dd as start_dd, current_timestamp as end_dd from 
timestamp_1) d1
+  join timestamp_2 as d2
+on d1.key = d2.key
+where d2.dd between start_dd and end_dd;
+
+drop table timestamp_1;
+drop table timestamp_2;
\ No newline at end of file
diff --git a/ql/src/test/queries/clientpositive/timestamptz_5.q 
b/ql/src/test/queries/clientpositive/timestamptz_5.q
new file mode 100644
index 000..d1e15ee
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/timestamptz_5.q
@@ -0,0 +1,16 @@
+set hive.cbo.enable=false;
+
+drop table if exists timestamplocaltz_n1;
+drop table if exists timestamplocaltz_n2;
+
+create table timestamplocaltz_n1 (key int, dd timestamp with local time zone);
+create table timestamplocaltz_n2 (key int, dd timestamp with local time zone);
+
+-- between clause with timestamp literal in join condition
+select d1.key, d2.dd
+  from (select key, dd as start_dd, current_timestamp as end_dd from 
timestamplocaltz_n1) d1
+  join timestamplocaltz_n2 as d2
+on d1.key = d2.key or d2.dd between timestamplocaltz '2010-04-01 00:00:00 
America/Los_Angeles' and timestamplocaltz '2010-04-02 00:00:00 
America/Los_Angeles';
+
+drop table timestamplocaltz_n1;
+drop table timestamplocaltz_n2;
\ No newline at end of file
diff --git a/ql/src/test/results/clientpositive/llap/timestamp_4.q.out 
b/ql/src/test/results/clientpositive/llap/timestamp_4.q.out
new file mode 100644
index 000..54864de
--- /dev/null
+++ b/ql/src/test/results/clientpositive/llap/timestamp_4.q.out
@@ -0,0 +1,58 @@
+PREHOOK: query: drop table if exists timestamp_1
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: drop table if exists timestamp_1
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: drop table if exists timestamp_2
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: drop table if exists timestamp_2
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: create table timestamp_1 (key int, dd timestamp)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@timestamp_1
+POSTHOOK: query: create table timestamp_1 (key int, dd timestamp)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@timestamp_1
+PREHOOK: query: create table timestamp_2 (key int, dd timestamp)
+PREHOOK: type: CREATETABLE