hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fei Hui (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HIVE-15849) hplsql should add enterGlobalScope func to UDF
Date Fri, 10 Feb 2017 02:12:41 GMT

     [ https://issues.apache.org/jira/browse/HIVE-15849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Fei Hui updated HIVE-15849:
---------------------------
    Description: 
code in Udf.java
{code:title=Udf.java|borderStyle=solid}
    if (exec == null) {
      exec = new Exec();
      exec.enterGlobalScope();
      String query = queryOI.getPrimitiveJavaObject(arguments[0].get());
      String[] args = { "-e", query, "-trace" };
      try {
        exec.setUdfRun(true);
        exec.init(args);
      } catch (Exception e) {
        throw new HiveException(e.getMessage());
      }
    }
    if (arguments.length > 1) {
      setParameters(arguments);
    }
    Var result = exec.run();
    if (result != null) {
      return result.toString();
    }
{code}

we should add 'exec.enterGlobalScope(); ' before set parameters

before add this function
we get the wrong result, result contains  empty string  
Starting pre-SQL statement
Starting pre-SQL statement
Starting pre-SQL statement
Starting pre-SQL statement
Starting pre-SQL statement
Starting query
Query executed successfully (2.30 sec)
Ln:8 SELECT completed successfully
Ln:8 Standalone SELECT executed: 1 columns in the result set
Hello, !
Hello, !

after fixing it
we get the right result
Starting pre-SQL statement
Starting pre-SQL statement
Starting pre-SQL statement
Starting pre-SQL statement
Starting pre-SQL statement
Starting query
Query executed successfully (2.35 sec)
Ln:8 SELECT completed successfully
Ln:8 Standalone SELECT executed: 1 columns in the result set
Hello, fei!
Hello, fei!

tests come from http://www.hplsql.org/udf

  was:
code in Udf.java
{quote}
    if (exec == null) {
      exec = new Exec();
      exec.enterGlobalScope();
      String query = queryOI.getPrimitiveJavaObject(arguments[0].get());
      String[] args = { "-e", query, "-trace" };
      try {
        exec.setUdfRun(true);
        exec.init(args);
      } catch (Exception e) {
        throw new HiveException(e.getMessage());
      }
    }
    if (arguments.length > 1) {
      setParameters(arguments);
    }
    Var result = exec.run();
    if (result != null) {
      return result.toString();
    }
{quote}

we should add 'exec.enterGlobalScope(); ' before set parameters

before fixing this
we get the wrong result, result contains  empty string  
Starting pre-SQL statement
Starting pre-SQL statement
Starting pre-SQL statement
Starting pre-SQL statement
Starting pre-SQL statement
Starting query
Query executed successfully (2.30 sec)
Ln:8 SELECT completed successfully
Ln:8 Standalone SELECT executed: 1 columns in the result set
Hello, !
Hello, !

after fixing it
we get the right result
Starting pre-SQL statement
Starting pre-SQL statement
Starting pre-SQL statement
Starting pre-SQL statement
Starting pre-SQL statement
Starting query
Query executed successfully (2.35 sec)
Ln:8 SELECT completed successfully
Ln:8 Standalone SELECT executed: 1 columns in the result set
Hello, fei!
Hello, fei!

tests come from HIVE-15832


> hplsql should add enterGlobalScope func to UDF
> ----------------------------------------------
>
>                 Key: HIVE-15849
>                 URL: https://issues.apache.org/jira/browse/HIVE-15849
>             Project: Hive
>          Issue Type: Bug
>          Components: hpl/sql
>    Affects Versions: 2.2.0
>            Reporter: Fei Hui
>            Assignee: Fei Hui
>         Attachments: HIVE-15849.patch
>
>
> code in Udf.java
> {code:title=Udf.java|borderStyle=solid}
>     if (exec == null) {
>       exec = new Exec();
>       exec.enterGlobalScope();
>       String query = queryOI.getPrimitiveJavaObject(arguments[0].get());
>       String[] args = { "-e", query, "-trace" };
>       try {
>         exec.setUdfRun(true);
>         exec.init(args);
>       } catch (Exception e) {
>         throw new HiveException(e.getMessage());
>       }
>     }
>     if (arguments.length > 1) {
>       setParameters(arguments);
>     }
>     Var result = exec.run();
>     if (result != null) {
>       return result.toString();
>     }
> {code}
> we should add 'exec.enterGlobalScope(); ' before set parameters
> before add this function
> we get the wrong result, result contains  empty string  
> Starting pre-SQL statement
> Starting pre-SQL statement
> Starting pre-SQL statement
> Starting pre-SQL statement
> Starting pre-SQL statement
> Starting query
> Query executed successfully (2.30 sec)
> Ln:8 SELECT completed successfully
> Ln:8 Standalone SELECT executed: 1 columns in the result set
> Hello, !
> Hello, !
> after fixing it
> we get the right result
> Starting pre-SQL statement
> Starting pre-SQL statement
> Starting pre-SQL statement
> Starting pre-SQL statement
> Starting pre-SQL statement
> Starting query
> Query executed successfully (2.35 sec)
> Ln:8 SELECT completed successfully
> Ln:8 Standalone SELECT executed: 1 columns in the result set
> Hello, fei!
> Hello, fei!
> tests come from http://www.hplsql.org/udf



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message