[
https://issues.apache.org/jira/browse/HIVE-29085?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated HIVE-29085:
----------------------------------
Labels: pull-request-available (was: )
> CREATE EXTERNAL TABLE fails for JDBC tables when both hive.sql.table and
> hive.sql.query are set
> -----------------------------------------------------------------------------------------------
>
> Key: HIVE-29085
> URL: https://issues.apache.org/jira/browse/HIVE-29085
> Project: Hive
> Issue Type: Bug
> Components: JDBC storage handler
> Affects Versions: 4.1.0
> Reporter: Soumyakanti Das
> Assignee: Soumyakanti Das
> Priority: Major
> Labels: pull-request-available
>
> When both hive.sql.table and hive.sql.query are set, we get the following
> exception:
>
> {code:java}
> org.apache.hadoop.hive.ql.metadata.HiveException:
> java.lang.RuntimeException:
> MetaException(message:org.apache.hadoop.hive.serde2.SerDeException Caught
> exception while initializing the SqlSerDe: null)
> at org.apache.hadoop.hive.ql.metadata.Hive.createTable(Hive.java:1431)
> at org.apache.hadoop.hive.ql.metadata.Hive.createTable(Hive.java:1436)
> at
> org.apache.hadoop.hive.ql.ddl.table.create.CreateTableOperation.createTableNonReplaceMode(CreateTableOperation.java:158)
> at
> org.apache.hadoop.hive.ql.ddl.table.create.CreateTableOperation.execute(CreateTableOperation.java:116)
> ...
> ...
> ...
> Caused by: java.lang.RuntimeException:
> MetaException(message:org.apache.hadoop.hive.serde2.SerDeException Caught
> exception while initializing the SqlSerDe: null)
> at
> org.apache.hadoop.hive.ql.metadata.Table.getDeserializerFromMetaStore(Table.java:359)
> at org.apache.hadoop.hive.ql.metadata.Table.getDeserializer(Table.java:343)
> at org.apache.hadoop.hive.ql.metadata.Hive.createTable(Hive.java:1366)
> ... 63 more
> Caused by: MetaException(message:org.apache.hadoop.hive.serde2.SerDeException
> Caught exception while initializing the SqlSerDe: null)
> at
> org.apache.hadoop.hive.metastore.HiveMetaStoreUtils.getDeserializer(HiveMetaStoreUtils.java:101)
> at
> org.apache.hadoop.hive.metastore.HiveMetaStoreUtils.getDeserializer(HiveMetaStoreUtils.java:80)
> at
> org.apache.hadoop.hive.ql.metadata.Table.getDeserializerFromMetaStore(Table.java:357)
> {code}
>
>
> This can be reproduced by copying the following to {{{}test.q{}}}:
> {noformat}
> CREATE EXTERNAL TABLE test_external_table_postgres
> (
> id INT,
> name STRING
> )
> STORED BY 'org.apache.hive.storage.jdbc.JdbcStorageHandler'
> TBLPROPERTIES (
> "hive.sql.database.type" = "POSTGRES",
> "hive.sql.jdbc.driver" = "org.postgresql.Driver",
> "hive.sql.jdbc.url" = "jdbc:postgresql://localhost:5432/test",
> "hive.sql.dbcp.username" = "hiveuser",
> "hive.sql.dbcp.password" = "password",
> "hive.sql.table" = "test",
> "hive.sql.query" = "select id, name from test"
> );{noformat}
> And running:
> {noformat}
> mvn test -pl itests/qtest -Pitests -Dtest=TestMiniLlapLocalCliDriver
> -Dtest.output.overwrite=true -Dqfile="test.q"{noformat}
> In the docs, it is mentioned that user should provide one or the other
> property, as can be seen here:
> [https://hive.apache.org/docs/latest/jdbc-storage-handler_95651916/]
> {noformat}
> hive.sql.table / hive.sql.query: You will need to specify either
> "hive.sql.table" or "hive.sql.query" to tell how to get data from jdbc
> database. "hive.sql.table" denotes a single table, and "hive.sql.query"
> denotes an arbitrary sql query.{noformat}
> Setting both properties together should not be allowed as a user can provide
> two different tables in those properties, but currently it doesn't fail
> gracefully.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)