[ https://issues.apache.org/jira/browse/HIVE-25591?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stamatis Zampetakis resolved HIVE-25591. ---------------------------------------- Fix Version/s: 4.0.0 Resolution: Fixed Fixed in [0616bcaa2436ccbf388b635bfea160b47849553c|https://github.com/apache/hive/commit/0616bcaa2436ccbf388b635bfea160b47849553c]. Thanks [~chiran54321] for the quick prototype and [~kkasa] for the review! > CREATE EXTERNAL TABLE fails for JDBC tables stored in non-default schema > ------------------------------------------------------------------------ > > Key: HIVE-25591 > URL: https://issues.apache.org/jira/browse/HIVE-25591 > Project: Hive > Issue Type: Bug > Components: Query Planning > Reporter: Stamatis Zampetakis > Assignee: Stamatis Zampetakis > Priority: Major > Labels: pull-request-available > Fix For: 4.0.0 > > Time Spent: 1h > Remaining Estimate: 0h > > Consider the following use case where tables reside in some user-defined > schema in some JDBC compliant database: > +Postgres+ > {code:sql} > create schema world; > create table if not exists world.country (name varchar(80) not null); > insert into world.country (name) values ('India'); > insert into world.country (name) values ('Russia'); > insert into world.country (name) values ('USA'); > {code} > The following DDL statement in Hive fails: > +Hive+ > {code:sql} > CREATE EXTERNAL TABLE country (name varchar(80)) > 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" = "user", > "hive.sql.dbcp.password" = "pwd", > "hive.sql.schema" = "world", > "hive.sql.table" = "country"); > {code} > The exception is the following: > {noformat} > org.postgresql.util.PSQLException: ERROR: relation "country" does not exist > Position: 15 > at > org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2532) > ~[postgresql-42.2.14.jar:42.2.14] > at > org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2267) > ~[postgresql-42.2.14.jar:42.2.14] > at > org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:312) > ~[postgresql-42.2.14.jar:42.2.14] > at > org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:448) > ~[postgresql-42.2.14.jar:42.2.14] > at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:369) > ~[postgresql-42.2.14.jar:42.2.14] > at > org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:153) > ~[postgresql-42.2.14.jar:42.2.14] > at > org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:103) > ~[postgresql-42.2.14.jar:42.2.14] > at > org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:122) > ~[commons-dbcp2-2.7.0.jar:2.7.0] > at > org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:122) > ~[commons-dbcp2-2.7.0.jar:2.7.0] > at > org.apache.hive.storage.jdbc.dao.GenericJdbcDatabaseAccessor.getColumnNames(GenericJdbcDatabaseAccessor.java:83) > [hive-jdbc-handler-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT] > at org.apache.hive.storage.jdbc.JdbcSerDe.initialize(JdbcSerDe.java:98) > [hive-jdbc-handler-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT] > at > org.apache.hadoop.hive.metastore.HiveMetaStoreUtils.getDeserializer(HiveMetaStoreUtils.java:95) > [hive-metastore-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT] > at > org.apache.hadoop.hive.metastore.HiveMetaStoreUtils.getDeserializer(HiveMetaStoreUtils.java:78) > [hive-metastore-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT] > at > org.apache.hadoop.hive.ql.metadata.Table.getDeserializerFromMetaStore(Table.java:342) > [hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT] > at > org.apache.hadoop.hive.ql.metadata.Table.getDeserializer(Table.java:324) > [hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT] > at > org.apache.hadoop.hive.ql.metadata.Table.getColsInternal(Table.java:734) > [hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT] > at org.apache.hadoop.hive.ql.metadata.Table.getCols(Table.java:717) > [hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT] > at > org.apache.hadoop.hive.ql.ddl.table.create.CreateTableDesc.toTable(CreateTableDesc.java:933) > [hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT] > at > org.apache.hadoop.hive.ql.ddl.table.create.CreateTableOperation.execute(CreateTableOperation.java:59) > [hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT] > at org.apache.hadoop.hive.ql.ddl.DDLTask.execute(DDLTask.java:84) > [hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT] > at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:212) > [hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT] > at > org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:105) > [hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT] > at org.apache.hadoop.hive.ql.Executor.launchTask(Executor.java:361) > [hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT] > at org.apache.hadoop.hive.ql.Executor.launchTasks(Executor.java:334) > [hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT] > at org.apache.hadoop.hive.ql.Executor.runTasks(Executor.java:245) > [hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT] > at org.apache.hadoop.hive.ql.Executor.execute(Executor.java:108) > [hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT] > at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:348) > [hive-exec-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT] > {noformat} -- This message was sent by Atlassian Jira (v8.3.4#803005)