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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]