You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Carter Shanklin (JIRA)" <ji...@apache.org> on 2017/07/04 21:22:01 UTC

[jira] [Created] (HIVE-17029) HPL/SQL: Comparison if not null-safe

Carter Shanklin created HIVE-17029:
--------------------------------------

             Summary: HPL/SQL: Comparison if not null-safe
                 Key: HIVE-17029
                 URL: https://issues.apache.org/jira/browse/HIVE-17029
             Project: Hive
          Issue Type: Bug
          Components: hpl/sql
            Reporter: Carter Shanklin


This bug is part of a series of issues and surprising behavior I encountered writing a reporting script that would aggregate values and give rows different classifications based on an the aggregate. Addressing some or all of these issues would make HPL/SQL more accessible to newcomers.

If you run a statement like:
{code}
  if val1i > val2i then
    print('val1 greater');
  end if;
{code}

And either val1 or val2 is null, you will get an exception similar to the following:
{code}
Unhandled exception in HPL/SQL
java.lang.NullPointerException
        at org.apache.hive.hplsql.Var.compareTo(Var.java:453)
        at org.apache.hive.hplsql.Expression.operatorCompare(Expression.java:454)
        at org.apache.hive.hplsql.Expression.execBoolBinary(Expression.java:178)
        at org.apache.hive.hplsql.Exec.visitBool_expr_binary(Exec.java:1589)
        at org.apache.hive.hplsql.Exec.visitBool_expr_binary(Exec.java:52)
        at org.apache.hive.hplsql.HplsqlParser$Bool_expr_binaryContext.accept(HplsqlParser.java:19397)
        at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:70)
        at org.apache.hive.hplsql.HplsqlBaseVisitor.visitBool_expr_atom(HplsqlBaseVisitor.java:1316)
        at org.apache.hive.hplsql.HplsqlParser$Bool_expr_atomContext.accept(HplsqlParser.java:18985)
        at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:42)
        at org.apache.hive.hplsql.Expression.visit(Expression.java:660)
        at org.apache.hive.hplsql.Expression.eval(Expression.java:624)
        at org.apache.hive.hplsql.Expression.execBool(Expression.java:121)
{code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)