[ 
https://issues.apache.org/jira/browse/IMPALA-914?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17949829#comment-17949829
 ] 

ASF subversion and git services commented on IMPALA-914:
--------------------------------------------------------

Commit cb496104d98e8cbd87acf25277f2648cffaac42a in impala's branch 
refs/heads/master from Riza Suminto
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=cb496104d ]

IMPALA-14027: Implement HS2 NULL_TYPE using TStringValue

HS2 NULL_TYPE should be implemented using TStringValue.

However, due to incompatibility with Hive JDBC driver implementation
then, Impala choose to implement NULL type using TBoolValue (see
IMPALA-914, IMPALA-1370).

HIVE-4172 might be the root cause for such decision. Today, the Hive
JDBC (org.apache.hive.jdbc.HiveDriver) does not have that issue anymore,
as shown in this reproduction after applying this patch:

./bin/run-jdbc-client.sh -q "select null" -t NOSASL
Using JDBC Driver Name: org.apache.hive.jdbc.HiveDriver
Connecting to: jdbc:hive2://localhost:21050/;auth=noSasl
Executing: select null
----[START]----
NULL
----[END]----
Returned 1 row(s) in 0.343s

Thus, we can reimplement NULL_TYPE using TStringValue to match
HiveServer2 behavior.

Testing:
- Pass core tests.

Change-Id: I354110164b360013d9893f1eb4398c3418f80472
Reviewed-on: http://gerrit.cloudera.org:8080/22852
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>


> NULL_TYPE is mapped to JDBC's USER_DEFINED_TYPE which causes problems for the 
> Hive JDBC driver.
> -----------------------------------------------------------------------------------------------
>
>                 Key: IMPALA-914
>                 URL: https://issues.apache.org/jira/browse/IMPALA-914
>             Project: IMPALA
>          Issue Type: Bug
>    Affects Versions: Impala 1.3
>            Reporter: Alexander Behm
>            Assignee: Alexander Behm
>            Priority: Major
>             Fix For: Impala 1.3.1
>
>
> this query fails through JDBC:
> {code}
> abehm@tp:~/impala/bin$ ./run-jdbc-client.sh -q "select null"
> Using JDBC Driver Name: org.apache.hive.jdbc.HiveDriver
> Connecting to: jdbc:hive2://localhost:21050/;auth=noSasl
> Executing: select null
> java.lang.IllegalArgumentException: Unregonized Thrift TTypeId value: 
> USER_DEFINED_TYPE
>       at org.apache.hive.service.cli.Type.getType(Type.java:122)
>       at 
> org.apache.hive.service.cli.TypeDescriptor.<init>(TypeDescriptor.java:43)
>       at 
> org.apache.hive.service.cli.ColumnDescriptor.<init>(ColumnDescriptor.java:46)
>       at org.apache.hive.service.cli.TableSchema.<init>(TableSchema.java:45)
>       at 
> org.apache.hive.jdbc.HiveQueryResultSet.retrieveSchema(HiveQueryResultSet.java:175)
>       at 
> org.apache.hive.jdbc.HiveQueryResultSet.<init>(HiveQueryResultSet.java:143)
>       at 
> org.apache.hive.jdbc.HiveQueryResultSet$Builder.build(HiveQueryResultSet.java:131)
>       at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:213)
>       at 
> org.apache.hive.jdbc.HiveStatement.executeQuery(HiveStatement.java:267)
>       at 
> com.cloudera.impala.testutil.ImpalaJdbcClient.execQuery(ImpalaJdbcClient.java:112)
>       at 
> com.cloudera.impala.testutil.ImpalaJdbcClient.execQuery(ImpalaJdbcClient.java:229)
>       at 
> com.cloudera.impala.testutil.ImpalaJdbcClient.main(ImpalaJdbcClient.java:279)
> Exception in thread "main" java.sql.SQLException: Could not create ResultSet: 
> Unregonized Thrift TTypeId value: USER_DEFINED_TYPE
>       at 
> org.apache.hive.jdbc.HiveQueryResultSet.retrieveSchema(HiveQueryResultSet.java:193)
>       at 
> org.apache.hive.jdbc.HiveQueryResultSet.<init>(HiveQueryResultSet.java:143)
>       at 
> org.apache.hive.jdbc.HiveQueryResultSet$Builder.build(HiveQueryResultSet.java:131)
>       at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:213)
>       at 
> org.apache.hive.jdbc.HiveStatement.executeQuery(HiveStatement.java:267)
>       at 
> com.cloudera.impala.testutil.ImpalaJdbcClient.execQuery(ImpalaJdbcClient.java:112)
>       at 
> com.cloudera.impala.testutil.ImpalaJdbcClient.execQuery(ImpalaJdbcClient.java:229)
>       at 
> com.cloudera.impala.testutil.ImpalaJdbcClient.main(ImpalaJdbcClient.java:279)
> Caused by: java.lang.IllegalArgumentException: Unregonized Thrift TTypeId 
> value: USER_DEFINED_TYPE
>       at org.apache.hive.service.cli.Type.getType(Type.java:122)
>       at 
> org.apache.hive.service.cli.TypeDescriptor.<init>(TypeDescriptor.java:43)
>       at 
> org.apache.hive.service.cli.ColumnDescriptor.<init>(ColumnDescriptor.java:46)
>       at org.apache.hive.service.cli.TableSchema.<init>(TableSchema.java:45)
>       at 
> org.apache.hive.jdbc.HiveQueryResultSet.retrieveSchema(HiveQueryResultSet.java:175)
>       ... 7 more
> {code}
> One could argue there are multiple issues here:
> 1. we return NULL_TYPE for the 'null' expr
> 2. we map NULL_TYPE to USER_DEFINED_TYPE in JDBC
> 3. Hive's JDBC driver can't deal with USER_DEFINED_TYPE
> We should consider fixing 1 and 2 on our end.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to