[ 
https://issues.apache.org/jira/browse/HIVE-24315?focusedWorklogId=569781&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-569781
 ]

ASF GitHub Bot logged work on HIVE-24315:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 22/Mar/21 15:18
            Start Date: 22/Mar/21 15:18
    Worklog Time Spent: 10m 
      Work Description: zeroflag commented on a change in pull request #2059:
URL: https://github.com/apache/hive/pull/2059#discussion_r598811189



##########
File path: hplsql/src/main/java/org/apache/hive/hplsql/Exec.java
##########
@@ -2256,24 +2276,26 @@ public Integer visitIdent(HplsqlParser.IdentContext 
ctx) {
           Var var1 = new Var(var);
           var1.negate();
           exec.stackPush(var1);
-        }
-        else {
+        } else {
           exec.stackPush(var);
         }
-      }
-      else {
+      } else {
         exec.stackPush(new Var(ident, Var.Type.STRING, var.toSqlString()));
       }
-    }
-    else {
-      if (!exec.buildSql && !exec.inCallStmt && 
exec.functions.exec(ident.toUpperCase(), null)) {
-        return 0;
+    } else {
+      if (exec.buildSql || exec.inCallStmt) {

Review comment:
       Calling a function without parentheses or call syntax is allowed by the 
language:
   
   ```
    f1;
   ```
   
   So this is treated as a function call if there is no variable defined as f1.
   
   The buildSql is mode where you type a HiveQL select (inCallStmt is similar 
but with the added EXEC command + sql string). If we are in these modes the 
identifier is likely a table column or an aggregate func within a HiveQL. 
   
   We don't need to execute the function in this case. Otherwise we try to 
interpret it as a function call, if that fails we throw an undef error.
   
   I think the first exec is not needed here.
   
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 569781)
    Time Spent: 2.5h  (was: 2h 20m)

> Improve validation and error handling in HPL/SQL 
> -------------------------------------------------
>
>                 Key: HIVE-24315
>                 URL: https://issues.apache.org/jira/browse/HIVE-24315
>             Project: Hive
>          Issue Type: Sub-task
>          Components: hpl/sql
>            Reporter: Attila Magyar
>            Assignee: Attila Magyar
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> There are some known issues that need to be fixed. For example it seems that 
> arity of a function is not checked when calling it, and same is true for 
> parameter types. Calling an undefined function is evaluated to null and 
> sometimes it seems that incorrect syntax is silently ignored. 
> In cases like this a helpful error message would be expected, thought we 
> should also consider how PL/SQL works and maintain compatibility.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to