hive git commit: HIVE-11432 : Hive macro give same result for different arguments (Pengcheng Xiong, reviewed by Hari Subramaniyan)

2015-08-06 Thread harisankar
Repository: hive
Updated Branches:
  refs/heads/branch-1 b8418b861 -> e9947776a


HIVE-11432 : Hive macro give same result for different arguments (Pengcheng 
Xiong, reviewed by Hari Subramaniyan)


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

Branch: refs/heads/branch-1
Commit: e9947776a4522f4d36b68ce2715599b1078f485c
Parents: b8418b8
Author: Hari Subramaniyan 
Authored: Thu Aug 6 12:26:24 2015 -0700
Committer: Hari Subramaniyan 
Committed: Thu Aug 6 12:26:59 2015 -0700

--
 .../hadoop/hive/ql/exec/FunctionRegistry.java   |  2 +-
 .../queries/clientpositive/macro_duplicate.q| 10 
 .../clientpositive/macro_duplicate.q.out| 56 
 3 files changed, 67 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/hive/blob/e9947776/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
--
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java 
b/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
index fabc21e..fb06d44 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
@@ -1281,7 +1281,7 @@ public final class FunctionRegistry {
   bridge.getUdfClassName());
 } else if (genericUDF instanceof GenericUDFMacro) {
   GenericUDFMacro bridge = (GenericUDFMacro) genericUDF;
-  clonedUDF = new GenericUDFMacro(bridge.getMacroName(), bridge.getBody(),
+  clonedUDF = new GenericUDFMacro(bridge.getMacroName(), 
bridge.getBody().clone(),
   bridge.getColNames(), bridge.getColTypes());
 } else {
   clonedUDF = ReflectionUtils.newInstance(genericUDF.getClass(), null);

http://git-wip-us.apache.org/repos/asf/hive/blob/e9947776/ql/src/test/queries/clientpositive/macro_duplicate.q
--
diff --git a/ql/src/test/queries/clientpositive/macro_duplicate.q 
b/ql/src/test/queries/clientpositive/macro_duplicate.q
new file mode 100644
index 000..dba38b1
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/macro_duplicate.q
@@ -0,0 +1,10 @@
+drop table macro_testing;
+CREATE TABLE macro_testing(a int, b int, c int);
+
+insert into table macro_testing values (1,2,3);
+insert into table macro_testing values (4,5,6);
+
+create temporary macro math_square(x int) x*x;
+create temporary macro math_add(x int) x+x;
+
+select math_square(a), math_square(b),factorial(a), factorial(b), math_add(a), 
math_add(b),int(c) from macro_testing;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/e9947776/ql/src/test/results/clientpositive/macro_duplicate.q.out
--
diff --git a/ql/src/test/results/clientpositive/macro_duplicate.q.out 
b/ql/src/test/results/clientpositive/macro_duplicate.q.out
new file mode 100644
index 000..4e62ccb
--- /dev/null
+++ b/ql/src/test/results/clientpositive/macro_duplicate.q.out
@@ -0,0 +1,56 @@
+PREHOOK: query: drop table macro_testing
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: drop table macro_testing
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: CREATE TABLE macro_testing(a int, b int, c int)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@macro_testing
+POSTHOOK: query: CREATE TABLE macro_testing(a int, b int, c int)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@macro_testing
+PREHOOK: query: insert into table macro_testing values (1,2,3)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@values__tmp__table__1
+PREHOOK: Output: default@macro_testing
+POSTHOOK: query: insert into table macro_testing values (1,2,3)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@values__tmp__table__1
+POSTHOOK: Output: default@macro_testing
+POSTHOOK: Lineage: macro_testing.a EXPRESSION 
[(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col1, 
type:string, comment:), ]
+POSTHOOK: Lineage: macro_testing.b EXPRESSION 
[(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col2, 
type:string, comment:), ]
+POSTHOOK: Lineage: macro_testing.c EXPRESSION 
[(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col3, 
type:string, comment:), ]
+PREHOOK: query: insert into table macro_testing values (4,5,6)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@values__tmp__table__2
+PREHOOK: Output: default@macro_testing
+POSTHOOK: query: insert into table macro_testing values (4,5,6)
+POSTHOOK: type: QUERY
+POSTHOOK: I

hive git commit: HIVE-11432 : Hive macro give same result for different arguments (Pengcheng Xiong, reviewed by Hari Subramaniyan)

2015-08-06 Thread harisankar
Repository: hive
Updated Branches:
  refs/heads/master d9663b586 -> 3fe7e4420


HIVE-11432 : Hive macro give same result for different arguments (Pengcheng 
Xiong, reviewed by Hari Subramaniyan)


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

Branch: refs/heads/master
Commit: 3fe7e442052b4822bf5311ec2dc8e31a34ee6950
Parents: d9663b5
Author: Hari Subramaniyan 
Authored: Thu Aug 6 12:26:24 2015 -0700
Committer: Hari Subramaniyan 
Committed: Thu Aug 6 12:26:24 2015 -0700

--
 .../hadoop/hive/ql/exec/FunctionRegistry.java   |  2 +-
 .../queries/clientpositive/macro_duplicate.q| 10 
 .../clientpositive/macro_duplicate.q.out| 56 
 3 files changed, 67 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/hive/blob/3fe7e442/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
--
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java 
b/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
index fabc21e..fb06d44 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java
@@ -1281,7 +1281,7 @@ public final class FunctionRegistry {
   bridge.getUdfClassName());
 } else if (genericUDF instanceof GenericUDFMacro) {
   GenericUDFMacro bridge = (GenericUDFMacro) genericUDF;
-  clonedUDF = new GenericUDFMacro(bridge.getMacroName(), bridge.getBody(),
+  clonedUDF = new GenericUDFMacro(bridge.getMacroName(), 
bridge.getBody().clone(),
   bridge.getColNames(), bridge.getColTypes());
 } else {
   clonedUDF = ReflectionUtils.newInstance(genericUDF.getClass(), null);

http://git-wip-us.apache.org/repos/asf/hive/blob/3fe7e442/ql/src/test/queries/clientpositive/macro_duplicate.q
--
diff --git a/ql/src/test/queries/clientpositive/macro_duplicate.q 
b/ql/src/test/queries/clientpositive/macro_duplicate.q
new file mode 100644
index 000..dba38b1
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/macro_duplicate.q
@@ -0,0 +1,10 @@
+drop table macro_testing;
+CREATE TABLE macro_testing(a int, b int, c int);
+
+insert into table macro_testing values (1,2,3);
+insert into table macro_testing values (4,5,6);
+
+create temporary macro math_square(x int) x*x;
+create temporary macro math_add(x int) x+x;
+
+select math_square(a), math_square(b),factorial(a), factorial(b), math_add(a), 
math_add(b),int(c) from macro_testing;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/3fe7e442/ql/src/test/results/clientpositive/macro_duplicate.q.out
--
diff --git a/ql/src/test/results/clientpositive/macro_duplicate.q.out 
b/ql/src/test/results/clientpositive/macro_duplicate.q.out
new file mode 100644
index 000..4e62ccb
--- /dev/null
+++ b/ql/src/test/results/clientpositive/macro_duplicate.q.out
@@ -0,0 +1,56 @@
+PREHOOK: query: drop table macro_testing
+PREHOOK: type: DROPTABLE
+POSTHOOK: query: drop table macro_testing
+POSTHOOK: type: DROPTABLE
+PREHOOK: query: CREATE TABLE macro_testing(a int, b int, c int)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@macro_testing
+POSTHOOK: query: CREATE TABLE macro_testing(a int, b int, c int)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@macro_testing
+PREHOOK: query: insert into table macro_testing values (1,2,3)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@values__tmp__table__1
+PREHOOK: Output: default@macro_testing
+POSTHOOK: query: insert into table macro_testing values (1,2,3)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@values__tmp__table__1
+POSTHOOK: Output: default@macro_testing
+POSTHOOK: Lineage: macro_testing.a EXPRESSION 
[(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col1, 
type:string, comment:), ]
+POSTHOOK: Lineage: macro_testing.b EXPRESSION 
[(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col2, 
type:string, comment:), ]
+POSTHOOK: Lineage: macro_testing.c EXPRESSION 
[(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col3, 
type:string, comment:), ]
+PREHOOK: query: insert into table macro_testing values (4,5,6)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@values__tmp__table__2
+PREHOOK: Output: default@macro_testing
+POSTHOOK: query: insert into table macro_testing values (4,5,6)
+POSTHOOK: type: QUERY
+POSTHOOK: Input