hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carter Shanklin (JIRA)" <>
Subject [jira] [Created] (HIVE-17023) HPL/SQL: NPE creating table if datatype lacks a precision and hplsql.conn.convert.hiveconn is false
Date Tue, 04 Jul 2017 21:22:00 GMT
Carter Shanklin created HIVE-17023:

             Summary: HPL/SQL: NPE creating table if datatype lacks a precision and hplsql.conn.convert.hiveconn
is false
                 Key: HIVE-17023
             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.

Consider this script:
create table if not exists test1(col1 integer);
create table if not exists test2(col1 double);
create table if not exists test3(col1 decimal(10, 4));
create table if not exists test4(col1 string);
create table if not exists test5(col1 varchar(20));

If you run with this config:


You will get exceptions like this for some of the types:

Exception in thread "main" java.lang.NullPointerException
        at org.apache.hive.hplsql.Exec.evalPop(
        at org.apache.hive.hplsql.Stmt.createTableDefinition(
        at org.apache.hive.hplsql.Stmt.createTable(
        at org.apache.hive.hplsql.Exec.visitCreate_table_stmt(
        at org.apache.hive.hplsql.Exec.visitCreate_table_stmt(
        at org.apache.hive.hplsql.HplsqlParser$Create_table_stmtContext.accept(
        at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(
        at org.apache.hive.hplsql.Exec.visitStmt(
        at org.apache.hive.hplsql.Exec.visitStmt(
        at org.apache.hive.hplsql.HplsqlParser$StmtContext.accept(

FAIL: create table test1 (col1 integer);
FAIL: create table test2 (col1 double);
SUCCESS: create table test3 (col1 decimal(10, 4));
FAIL: create table test4 (col1 string);
SUCCESS: create table test5(col1 varchar(20));

Problem boils down to this line in
        exec.append(sql, exec.evalPop(col.dtype(), col.dtype_len()), col.column_name().getStop(),
Because col.dtype_len() returns null

I have to wonder if not converting is ever a good idea? If it's always a bad idea(tm) why
even have it?

Version = 3.0.0-SNAPSHOT r71f52d8ad512904b3f2c4f04fe39a33f2834f1f2

This message was sent by Atlassian JIRA

View raw message