You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Dmitry Tolpeko (JIRA)" <ji...@apache.org> on 2017/09/11 09:22:00 UTC

[jira] [Assigned] (HIVE-17023) HPL/SQL: NPE creating table if datatype lacks a precision and hplsql.conn.convert.hiveconn is false

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

Dmitry Tolpeko reassigned HIVE-17023:
-------------------------------------

    Assignee: Dmitry Tolpeko

> HPL/SQL: NPE creating table if datatype lacks a precision and hplsql.conn.convert.hiveconn is false
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-17023
>                 URL: https://issues.apache.org/jira/browse/HIVE-17023
>             Project: Hive
>          Issue Type: Bug
>          Components: hpl/sql
>            Reporter: Carter Shanklin
>            Assignee: Dmitry Tolpeko
>
> 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:
> <configuration>
>   <property>
>     <name>hplsql.conn.default</name>
>     <value>hiveconn</value>
>   </property>
>   <property>
>     <name>hplsql.conn.hiveconn</name>
>     <value>org.apache.hive.jdbc.HiveDriver;jdbc:hive2://</value>
>   </property>
> </configuration>
> 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(Exec.java:2398)
>         at org.apache.hive.hplsql.Stmt.createTableDefinition(Stmt.java:169)
>         at org.apache.hive.hplsql.Stmt.createTable(Stmt.java:142)
>         at org.apache.hive.hplsql.Exec.visitCreate_table_stmt(Exec.java:1366)
>         at org.apache.hive.hplsql.Exec.visitCreate_table_stmt(Exec.java:52)
>         at org.apache.hive.hplsql.HplsqlParser$Create_table_stmtContext.accept(HplsqlParser.java:4198)
>         at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:70)
>         at org.apache.hive.hplsql.Exec.visitStmt(Exec.java:1013)
>         at org.apache.hive.hplsql.Exec.visitStmt(Exec.java:52)
>         at org.apache.hive.hplsql.HplsqlParser$StmtContext.accept(HplsqlParser.java:1018)
> ...
> 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 Stmt.java:
>         exec.append(sql, exec.evalPop(col.dtype(), col.dtype_len()), col.column_name().getStop(), col.dtype().getStart());
> 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
(v6.4.14#64029)