You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2016/09/08 01:52:46 UTC

[26/38] hive git commit: HIVE-13556 : Support for double precision data type (Zoltan Haindrich via Ashutosh Chauhan) Signed-off-by: Ashutosh Chauhan

HIVE-13556 : Support for double precision data type (Zoltan Haindrich via Ashutosh Chauhan)
Signed-off-by: Ashutosh Chauhan <ha...@apache.org>


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

Branch: refs/heads/hive-14535
Commit: 2de450a1cb709a406e3d31d4f6b08c67e502d9af
Parents: ddda38b
Author: Zoltan Haindrich <ki...@rxd.hu>
Authored: Tue Sep 6 10:50:25 2016 -0700
Committer: Ashutosh Chauhan <ha...@apache.org>
Committed: Tue Sep 6 10:50:25 2016 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hive/ql/parse/HiveLexer.g     |  1 +
 .../org/apache/hadoop/hive/ql/parse/HiveParser.g    |  3 ++-
 .../apache/hadoop/hive/ql/parse/IdentifiersParser.g |  1 +
 .../test/queries/clientpositive/double_precision.q  |  2 ++
 .../results/clientpositive/double_precision.q.out   | 16 ++++++++++++++++
 5 files changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/2de450a1/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
index 665c3bb..7ceb005 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
@@ -124,6 +124,7 @@ KW_INT: 'INT';
 KW_BIGINT: 'BIGINT';
 KW_FLOAT: 'FLOAT';
 KW_DOUBLE: 'DOUBLE';
+KW_PRECISION: 'PRECISION';
 KW_DATE: 'DATE';
 KW_DATETIME: 'DATETIME';
 KW_TIMESTAMP: 'TIMESTAMP';

http://git-wip-us.apache.org/repos/asf/hive/blob/2de450a1/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
index ecdefa9..df596ff 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
@@ -466,6 +466,7 @@ import org.apache.hadoop.hive.conf.HiveConf;
     xlateMap.put("KW_BIGINT", "BIGINT");
     xlateMap.put("KW_FLOAT", "FLOAT");
     xlateMap.put("KW_DOUBLE", "DOUBLE");
+    xlateMap.put("KW_PRECISION", "PRECISION");
     xlateMap.put("KW_DATE", "DATE");
     xlateMap.put("KW_DATETIME", "DATETIME");
     xlateMap.put("KW_TIMESTAMP", "TIMESTAMP");
@@ -2232,7 +2233,7 @@ primitiveType
     | KW_BIGINT        ->    TOK_BIGINT
     | KW_BOOLEAN       ->    TOK_BOOLEAN
     | KW_FLOAT         ->    TOK_FLOAT
-    | KW_DOUBLE        ->    TOK_DOUBLE
+    | KW_DOUBLE KW_PRECISION?       ->    TOK_DOUBLE
     | KW_DATE          ->    TOK_DATE
     | KW_DATETIME      ->    TOK_DATETIME
     | KW_TIMESTAMP     ->    TOK_TIMESTAMP

http://git-wip-us.apache.org/repos/asf/hive/blob/2de450a1/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g b/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
index 0bbc4b6..9ba1865 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
@@ -700,4 +700,5 @@ sql11ReservedKeywordsUsedAsIdentifier
     | KW_FOREIGN
     | KW_CONSTRAINT
     | KW_REFERENCES
+    | KW_PRECISION
     ;

http://git-wip-us.apache.org/repos/asf/hive/blob/2de450a1/ql/src/test/queries/clientpositive/double_precision.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/double_precision.q b/ql/src/test/queries/clientpositive/double_precision.q
new file mode 100644
index 0000000..ab7c839
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/double_precision.q
@@ -0,0 +1,2 @@
+create table dp (a double precision, b double precision);
+describe dp;

http://git-wip-us.apache.org/repos/asf/hive/blob/2de450a1/ql/src/test/results/clientpositive/double_precision.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/double_precision.q.out b/ql/src/test/results/clientpositive/double_precision.q.out
new file mode 100644
index 0000000..1057278
--- /dev/null
+++ b/ql/src/test/results/clientpositive/double_precision.q.out
@@ -0,0 +1,16 @@
+PREHOOK: query: create table dp (a double precision, b double precision)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@dp
+POSTHOOK: query: create table dp (a double precision, b double precision)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@dp
+PREHOOK: query: describe dp
+PREHOOK: type: DESCTABLE
+PREHOOK: Input: default@dp
+POSTHOOK: query: describe dp
+POSTHOOK: type: DESCTABLE
+POSTHOOK: Input: default@dp
+a                   	double              	                    
+b                   	double