hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prasan...@apache.org
Subject hive git commit: HIVE-12596: Delete timestamp row throws java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff] (Prasanth Jayachandran reviewd by Owen O'Malley)
Date Fri, 11 Dec 2015 03:46:16 GMT
Repository: hive
Updated Branches:
  refs/heads/branch-2.0 2edb7391f -> cb2be8a8f


HIVE-12596: Delete timestamp row throws java.lang.IllegalArgumentException: Timestamp format
must be yyyy-mm-dd hh:mm:ss[.fffffffff] (Prasanth Jayachandran reviewd by Owen O'Malley)


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

Branch: refs/heads/branch-2.0
Commit: cb2be8a8f9107bac975d678378538e54dedce90d
Parents: 2edb739
Author: Prasanth Jayachandran <j.prasanth.j@gmail.com>
Authored: Thu Dec 10 21:45:12 2015 -0600
Committer: Prasanth Jayachandran <j.prasanth.j@gmail.com>
Committed: Thu Dec 10 21:45:52 2015 -0600

----------------------------------------------------------------------
 .../hive/ql/io/sarg/ConvertAstToSearchArg.java  | 56 +++++++++++---------
 .../queries/clientpositive/orc_ppd_exception.q  | 14 +++++
 .../clientpositive/orc_ppd_exception.q.out      | 49 +++++++++++++++++
 3 files changed, 94 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/cb2be8a8/ql/src/java/org/apache/hadoop/hive/ql/io/sarg/ConvertAstToSearchArg.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/sarg/ConvertAstToSearchArg.java b/ql/src/java/org/apache/hadoop/hive/ql/io/sarg/ConvertAstToSearchArg.java
index 6d3a134..1fa94b9 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/io/sarg/ConvertAstToSearchArg.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/io/sarg/ConvertAstToSearchArg.java
@@ -260,31 +260,37 @@ public class ConvertAstToSearchArg {
       builder.startNot();
     }
 
-    switch (operator) {
-      case IS_NULL:
-        builder.isNull(columnName, type);
-        break;
-      case EQUALS:
-        builder.equals(columnName, type, findLiteral(expression, type));
-        break;
-      case NULL_SAFE_EQUALS:
-        builder.nullSafeEquals(columnName, type, findLiteral(expression, type));
-        break;
-      case LESS_THAN:
-        builder.lessThan(columnName, type, findLiteral(expression, type));
-        break;
-      case LESS_THAN_EQUALS:
-        builder.lessThanEquals(columnName, type, findLiteral(expression, type));
-        break;
-      case IN:
-        builder.in(columnName, type,
-            getLiteralList(expression, type, variable + 1));
-        break;
-      case BETWEEN:
-        builder.between(columnName, type,
-            getLiteral(expression, type, variable + 1),
-            getLiteral(expression, type, variable + 2));
-        break;
+    try {
+      switch (operator) {
+        case IS_NULL:
+          builder.isNull(columnName, type);
+          break;
+        case EQUALS:
+          builder.equals(columnName, type, findLiteral(expression, type));
+          break;
+        case NULL_SAFE_EQUALS:
+          builder.nullSafeEquals(columnName, type, findLiteral(expression, type));
+          break;
+        case LESS_THAN:
+          builder.lessThan(columnName, type, findLiteral(expression, type));
+          break;
+        case LESS_THAN_EQUALS:
+          builder.lessThanEquals(columnName, type, findLiteral(expression, type));
+          break;
+        case IN:
+          builder.in(columnName, type,
+              getLiteralList(expression, type, variable + 1));
+          break;
+        case BETWEEN:
+          builder.between(columnName, type,
+              getLiteral(expression, type, variable + 1),
+              getLiteral(expression, type, variable + 2));
+          break;
+      }
+    } catch (Exception e) {
+      LOG.warn("Exception thrown during SARG creation. Returning YES_NO_NULL." +
+          " Exception: " + e.getMessage());
+      builder.literal(SearchArgument.TruthValue.YES_NO_NULL);
     }
 
     if (needSwap) {

http://git-wip-us.apache.org/repos/asf/hive/blob/cb2be8a8/ql/src/test/queries/clientpositive/orc_ppd_exception.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/orc_ppd_exception.q b/ql/src/test/queries/clientpositive/orc_ppd_exception.q
new file mode 100644
index 0000000..1513d91
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/orc_ppd_exception.q
@@ -0,0 +1,14 @@
+set hive.mapred.mode=nonstrict;
+set hive.support.concurrency=true;
+set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;
+set hive.optimize.index.filter=true;
+set hive.cbo.enable=false;
+
+create table test_acid( i int, ts timestamp)
+                      clustered by (i) into 2 buckets
+                      stored as orc
+                      tblproperties ('transactional'='true');
+insert into table test_acid values (1, '2014-09-14 12:34:30');
+delete from test_acid where ts = '2014-15-16 17:18:19.20';
+select i,ts from test_acid where ts = '2014-15-16 17:18:19.20';
+select i,ts from test_acid where ts <= '2014-09-14 12:34:30';

http://git-wip-us.apache.org/repos/asf/hive/blob/cb2be8a8/ql/src/test/results/clientpositive/orc_ppd_exception.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/orc_ppd_exception.q.out b/ql/src/test/results/clientpositive/orc_ppd_exception.q.out
new file mode 100644
index 0000000..f9c7b52
--- /dev/null
+++ b/ql/src/test/results/clientpositive/orc_ppd_exception.q.out
@@ -0,0 +1,49 @@
+PREHOOK: query: create table test_acid( i int, ts timestamp)
+                      clustered by (i) into 2 buckets
+                      stored as orc
+                      tblproperties ('transactional'='true')
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@test_acid
+POSTHOOK: query: create table test_acid( i int, ts timestamp)
+                      clustered by (i) into 2 buckets
+                      stored as orc
+                      tblproperties ('transactional'='true')
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@test_acid
+PREHOOK: query: insert into table test_acid values (1, '2014-09-14 12:34:30')
+PREHOOK: type: QUERY
+PREHOOK: Input: default@values__tmp__table__1
+PREHOOK: Output: default@test_acid
+POSTHOOK: query: insert into table test_acid values (1, '2014-09-14 12:34:30')
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@values__tmp__table__1
+POSTHOOK: Output: default@test_acid
+POSTHOOK: Lineage: test_acid.i EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col1,
type:string, comment:), ]
+POSTHOOK: Lineage: test_acid.ts EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col2,
type:string, comment:), ]
+PREHOOK: query: delete from test_acid where ts = '2014-15-16 17:18:19.20'
+PREHOOK: type: QUERY
+PREHOOK: Input: default@test_acid
+PREHOOK: Output: default@test_acid
+POSTHOOK: query: delete from test_acid where ts = '2014-15-16 17:18:19.20'
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@test_acid
+POSTHOOK: Output: default@test_acid
+PREHOOK: query: select i,ts from test_acid where ts = '2014-15-16 17:18:19.20'
+PREHOOK: type: QUERY
+PREHOOK: Input: default@test_acid
+#### A masked pattern was here ####
+POSTHOOK: query: select i,ts from test_acid where ts = '2014-15-16 17:18:19.20'
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@test_acid
+#### A masked pattern was here ####
+PREHOOK: query: select i,ts from test_acid where ts <= '2014-09-14 12:34:30'
+PREHOOK: type: QUERY
+PREHOOK: Input: default@test_acid
+#### A masked pattern was here ####
+POSTHOOK: query: select i,ts from test_acid where ts <= '2014-09-14 12:34:30'
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@test_acid
+#### A masked pattern was here ####
+1	2014-09-14 12:34:30


Mime
View raw message