hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jxi...@apache.org
Subject [26/55] [abbrv] hive git commit: HIVE-12297: CBO: Calcite Operator To Hive Operator (Calcite Return Path) : dealing with '$' in typeInfo (Pengcheng Xiong, reviewed by Ashutosh Chauhan)
Date Fri, 06 Nov 2015 17:33:08 GMT
HIVE-12297: CBO: Calcite Operator To Hive Operator (Calcite Return Path) : dealing with '$'
in typeInfo (Pengcheng Xiong, reviewed by Ashutosh Chauhan)


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

Branch: refs/heads/master-fixed
Commit: 6237615835d6b35c13d49ccb2bc1cd345fc3cf13
Parents: 50177ef
Author: Pengcheng Xiong <pxiong@apache.org>
Authored: Tue Nov 3 11:24:01 2015 -0800
Committer: Pengcheng Xiong <pxiong@apache.org>
Committed: Tue Nov 3 11:24:01 2015 -0800

----------------------------------------------------------------------
 .../test/queries/clientpositive/cbo_udf_max.q   | 36 ++++++++++++
 .../results/clientpositive/cbo_udf_max.q.out    | 62 ++++++++++++++++++++
 .../hive/serde2/typeinfo/TypeInfoUtils.java     |  5 +-
 3 files changed, 102 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/62376158/ql/src/test/queries/clientpositive/cbo_udf_max.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/cbo_udf_max.q b/ql/src/test/queries/clientpositive/cbo_udf_max.q
new file mode 100644
index 0000000..c22e89b
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/cbo_udf_max.q
@@ -0,0 +1,36 @@
+set hive.cbo.returnpath.hiveop=true;
+
+DESCRIBE FUNCTION max;
+DESCRIBE FUNCTION EXTENDED max;
+
+
+set hive.map.aggr = false;
+set hive.groupby.skewindata = false;
+
+SELECT max(struct(CAST(key as INT), value)),
+       max(struct(key, value))
+FROM src;
+
+
+set hive.map.aggr = true;
+set hive.groupby.skewindata = false;
+
+SELECT max(struct(CAST(key as INT), value)),
+       max(struct(key, value))
+FROM src;
+
+
+set hive.map.aggr = false;
+set hive.groupby.skewindata = true;
+
+SELECT max(struct(CAST(key as INT), value)),
+       max(struct(key, value))
+FROM src;
+
+
+set hive.map.aggr = true;
+set hive.groupby.skewindata = true;
+
+SELECT max(struct(CAST(key as INT), value)),
+       max(struct(key, value))
+FROM src;

http://git-wip-us.apache.org/repos/asf/hive/blob/62376158/ql/src/test/results/clientpositive/cbo_udf_max.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/cbo_udf_max.q.out b/ql/src/test/results/clientpositive/cbo_udf_max.q.out
new file mode 100644
index 0000000..410cf31
--- /dev/null
+++ b/ql/src/test/results/clientpositive/cbo_udf_max.q.out
@@ -0,0 +1,62 @@
+PREHOOK: query: DESCRIBE FUNCTION max
+PREHOOK: type: DESCFUNCTION
+POSTHOOK: query: DESCRIBE FUNCTION max
+POSTHOOK: type: DESCFUNCTION
+max(expr) - Returns the maximum value of expr
+PREHOOK: query: DESCRIBE FUNCTION EXTENDED max
+PREHOOK: type: DESCFUNCTION
+POSTHOOK: query: DESCRIBE FUNCTION EXTENDED max
+POSTHOOK: type: DESCFUNCTION
+max(expr) - Returns the maximum value of expr
+PREHOOK: query: SELECT max(struct(CAST(key as INT), value)),
+       max(struct(key, value))
+FROM src
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT max(struct(CAST(key as INT), value)),
+       max(struct(key, value))
+FROM src
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+{"expr$0":498,"expr$1":"val_498"}	{"expr$0":498,"expr$1":"val_498"}
+PREHOOK: query: SELECT max(struct(CAST(key as INT), value)),
+       max(struct(key, value))
+FROM src
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT max(struct(CAST(key as INT), value)),
+       max(struct(key, value))
+FROM src
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+{"expr$0":498,"expr$1":"val_498"}	{"expr$0":"98","expr$1":"val_98"}
+PREHOOK: query: SELECT max(struct(CAST(key as INT), value)),
+       max(struct(key, value))
+FROM src
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT max(struct(CAST(key as INT), value)),
+       max(struct(key, value))
+FROM src
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+{"expr$0":498,"expr$1":"val_498"}	{"expr$0":498,"expr$1":"val_498"}
+PREHOOK: query: SELECT max(struct(CAST(key as INT), value)),
+       max(struct(key, value))
+FROM src
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT max(struct(CAST(key as INT), value)),
+       max(struct(key, value))
+FROM src
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+{"expr$0":498,"expr$1":"val_498"}	{"expr$0":"98","expr$1":"val_98"}

http://git-wip-us.apache.org/repos/asf/hive/blob/62376158/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoUtils.java
----------------------------------------------------------------------
diff --git a/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoUtils.java b/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoUtils.java
index a4323d1..24361c7 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoUtils.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoUtils.java
@@ -256,7 +256,7 @@ public final class TypeInfoUtils {
     };
 
     private static boolean isTypeChar(char c) {
-      return Character.isLetterOrDigit(c) || c == '_' || c == '.' || c == ' ';
+      return Character.isLetterOrDigit(c) || c == '_' || c == '.' || c == ' ' || c == '$';
     }
 
     /**
@@ -266,6 +266,9 @@ public final class TypeInfoUtils {
      *
      * tokenize("map<int,string>") should return
      * ["map","<","int",",","string",">"]
+     * 
+     * Note that we add '$' in new Calcite return path. As '$' will not appear
+     * in any type in Hive, it is safe to do so.
      */
     private static ArrayList<Token> tokenize(String typeInfoString) {
       ArrayList<Token> tokens = new ArrayList<Token>(0);


Mime
View raw message