hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ser...@apache.org
Subject [01/50] [abbrv] hive git commit: HIVE-17452: HPL/SQL function variable block is not initialized (Dmitry Tolpeko, reviewed by Alan Gates)
Date Wed, 27 Sep 2017 20:22:36 GMT
Repository: hive
Updated Branches:
  refs/heads/hive-14535 5b3c79798 -> 379d9babd


HIVE-17452: HPL/SQL function variable block is not initialized (Dmitry Tolpeko, reviewed by
Alan Gates)


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

Branch: refs/heads/hive-14535
Commit: df8ddbf2ebda8eb0b084650936be2d89e8a45d39
Parents: 86755f6
Author: Dmitry Tolpeko <dmtolpeko@gmail.com>
Authored: Sun Sep 24 22:18:08 2017 +0000
Committer: Dmitry Tolpeko <dmtolpeko@gmail.com>
Committed: Sun Sep 24 22:18:08 2017 +0000

----------------------------------------------------------------------
 .../java/org/apache/hive/hplsql/functions/Function.java  |  3 +++
 .../java/org/apache/hive/hplsql/TestHplsqlLocal.java     | 10 ++++++++++
 hplsql/src/test/queries/local/create_function5.sql       | 11 +++++++++++
 hplsql/src/test/queries/local/create_procedure4.sql      | 10 ++++++++++
 hplsql/src/test/results/local/create_function3.out.txt   |  2 ++
 hplsql/src/test/results/local/create_function4.out.txt   |  1 +
 hplsql/src/test/results/local/create_function5.out.txt   |  8 ++++++++
 hplsql/src/test/results/local/create_procedure4.out.txt  |  8 ++++++++
 8 files changed, 53 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/df8ddbf2/hplsql/src/main/java/org/apache/hive/hplsql/functions/Function.java
----------------------------------------------------------------------
diff --git a/hplsql/src/main/java/org/apache/hive/hplsql/functions/Function.java b/hplsql/src/main/java/org/apache/hive/hplsql/functions/Function.java
index ed60d23..a603971 100644
--- a/hplsql/src/main/java/org/apache/hive/hplsql/functions/Function.java
+++ b/hplsql/src/main/java/org/apache/hive/hplsql/functions/Function.java
@@ -143,6 +143,9 @@ public class Function {
     ArrayList<Var> actualParams = getActualCallParameters(ctx);
     exec.enterScope(Scope.Type.ROUTINE);
     setCallParameters(ctx, actualParams, userCtx.create_routine_params(), null);
+    if (userCtx.declare_block_inplace() != null) {
+      visit(userCtx.declare_block_inplace());
+    }
     visit(userCtx.single_block_stmt());
     exec.leaveScope(); 
     return true;

http://git-wip-us.apache.org/repos/asf/hive/blob/df8ddbf2/hplsql/src/test/java/org/apache/hive/hplsql/TestHplsqlLocal.java
----------------------------------------------------------------------
diff --git a/hplsql/src/test/java/org/apache/hive/hplsql/TestHplsqlLocal.java b/hplsql/src/test/java/org/apache/hive/hplsql/TestHplsqlLocal.java
index 8692661..34e8dfa 100644
--- a/hplsql/src/test/java/org/apache/hive/hplsql/TestHplsqlLocal.java
+++ b/hplsql/src/test/java/org/apache/hive/hplsql/TestHplsqlLocal.java
@@ -107,6 +107,11 @@ public class TestHplsqlLocal {
   public void testCreateFunction4() throws Exception {
     run("create_function4");
   }
+  
+  @Test
+  public void testCreateFunction5() throws Exception {
+    run("create_function5");
+  }
 
   @Test
   public void testCreatePackage() throws Exception {
@@ -139,6 +144,11 @@ public class TestHplsqlLocal {
   }
   
   @Test
+  public void testCreateProcedure4() throws Exception {
+    run("create_procedure4");
+  }
+  
+  @Test
   public void testCreateProcedureNoParams() throws Exception {
     run("create_procedure_no_params");
   }

http://git-wip-us.apache.org/repos/asf/hive/blob/df8ddbf2/hplsql/src/test/queries/local/create_function5.sql
----------------------------------------------------------------------
diff --git a/hplsql/src/test/queries/local/create_function5.sql b/hplsql/src/test/queries/local/create_function5.sql
new file mode 100644
index 0000000..cfad9b3
--- /dev/null
+++ b/hplsql/src/test/queries/local/create_function5.sql
@@ -0,0 +1,11 @@
+CREATE FUNCTION test1()
+  RETURNS STRING
+AS
+  ret string DEFAULT 'Initial value';
+BEGIN
+  print(ret);
+  ret := 'VALUE IS SET';
+  print(ret);
+END;
+
+test1();

http://git-wip-us.apache.org/repos/asf/hive/blob/df8ddbf2/hplsql/src/test/queries/local/create_procedure4.sql
----------------------------------------------------------------------
diff --git a/hplsql/src/test/queries/local/create_procedure4.sql b/hplsql/src/test/queries/local/create_procedure4.sql
new file mode 100644
index 0000000..9c05d4a
--- /dev/null
+++ b/hplsql/src/test/queries/local/create_procedure4.sql
@@ -0,0 +1,10 @@
+CREATE PROCEDURE test1()
+AS
+  ret string DEFAULT 'Initial value';
+BEGIN
+  print(ret);
+  ret := 'VALUE IS SET';
+  print(ret);
+END;
+
+test1();

http://git-wip-us.apache.org/repos/asf/hive/blob/df8ddbf2/hplsql/src/test/results/local/create_function3.out.txt
----------------------------------------------------------------------
diff --git a/hplsql/src/test/results/local/create_function3.out.txt b/hplsql/src/test/results/local/create_function3.out.txt
index 90974ed..1686350 100644
--- a/hplsql/src/test/results/local/create_function3.out.txt
+++ b/hplsql/src/test/results/local/create_function3.out.txt
@@ -2,6 +2,7 @@ Ln:1 CREATE FUNCTION gettype
 Ln:57 EXEC FUNCTION gettype
 Ln:57 SET PARAM tag1 = YHHPD
 Ln:57 SET PARAM srcvalue = a
+Ln:2 DECLARE tmpVar varchar2
 Ln:5 IF
 Ln:9 IF
 Ln:13 IF
@@ -16,6 +17,7 @@ Ln:34 RETURN
 Ln:58 EXEC FUNCTION gettype
 Ln:58 SET PARAM tag1 = YHHPD
 Ln:58 SET PARAM srcvalue = @I
+Ln:2 DECLARE tmpVar varchar2
 Ln:5 IF
 Ln:5 IF TRUE executed
 Ln:6 RETURN

http://git-wip-us.apache.org/repos/asf/hive/blob/df8ddbf2/hplsql/src/test/results/local/create_function4.out.txt
----------------------------------------------------------------------
diff --git a/hplsql/src/test/results/local/create_function4.out.txt b/hplsql/src/test/results/local/create_function4.out.txt
index d8daae5..cefd908 100644
--- a/hplsql/src/test/results/local/create_function4.out.txt
+++ b/hplsql/src/test/results/local/create_function4.out.txt
@@ -1,6 +1,7 @@
 Ln:1 CREATE FUNCTION get
 Ln:19 EXEC FUNCTION get
 Ln:19 SET PARAM CODE = abc
+Ln:2 DECLARE TMPVAR VARCHAR2
 Ln:5 SET TMPVAR = ''
 Ln:7 IF
 Ln:7 IF TRUE executed

http://git-wip-us.apache.org/repos/asf/hive/blob/df8ddbf2/hplsql/src/test/results/local/create_function5.out.txt
----------------------------------------------------------------------
diff --git a/hplsql/src/test/results/local/create_function5.out.txt b/hplsql/src/test/results/local/create_function5.out.txt
new file mode 100644
index 0000000..117abe6
--- /dev/null
+++ b/hplsql/src/test/results/local/create_function5.out.txt
@@ -0,0 +1,8 @@
+Ln:1 CREATE FUNCTION test1
+EXEC FUNCTION test1
+Ln:4 DECLARE ret string = 'Initial value'
+Ln:6 PRINT
+Initial value
+Ln:7 SET ret = 'VALUE IS SET'
+Ln:8 PRINT
+VALUE IS SET
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/df8ddbf2/hplsql/src/test/results/local/create_procedure4.out.txt
----------------------------------------------------------------------
diff --git a/hplsql/src/test/results/local/create_procedure4.out.txt b/hplsql/src/test/results/local/create_procedure4.out.txt
new file mode 100644
index 0000000..1e1c6a0
--- /dev/null
+++ b/hplsql/src/test/results/local/create_procedure4.out.txt
@@ -0,0 +1,8 @@
+Ln:1 CREATE PROCEDURE test1
+EXEC PROCEDURE test1
+Ln:3 DECLARE ret string = 'Initial value'
+Ln:5 PRINT
+Initial value
+Ln:6 SET ret = 'VALUE IS SET'
+Ln:7 PRINT
+VALUE IS SET
\ No newline at end of file


Mime
View raw message