Soumyakanti Das created HIVE-29308:
--------------------------------------

             Summary: Unescape jdbc table names to support case sensitive names
                 Key: HIVE-29308
                 URL: https://issues.apache.org/jira/browse/HIVE-29308
             Project: Hive
          Issue Type: Bug
          Components: JDBC, JDBC storage handler
    Affects Versions: 4.2.0
            Reporter: Soumyakanti Das
            Assignee: Soumyakanti Das
         Attachments: jdbc_case_sensitive_table_postgres.q, 
q_test_country_table_case_sensitive.sql

To reproduce this, copy q_test_country_table_case_sensitive.sql to data/scripts 
and then copy jdbc_case_sensitive_table_postgres.q to queries/clientpositive.

Run:
{noformat}
mvn test -pl itests/qtest -Pitests -Dtest=TestMiniLlapLocalCliDriver 
-Dtest.output.overwrite=true 
-Dqfile=jdbc_case_sensitive_table_postgres.q{noformat}
When authorization is enabled, we see:
{noformat}
[ERROR] Failures:[ERROR]   TestMiniLlapLocalCliDriver.testCliDriver:62 Client 
execution failed with error code = 40000running
CREATE EXTERNAL TABLE country (id int, name varchar(20))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" = 
"${system:hive.test.database.qdb.jdbc.url}",    "hive.sql.dbcp.username" = 
"${system:hive.test.database.qdb.jdbc.username}",    "hive.sql.dbcp.password" = 
"${system:hive.test.database.qdb.jdbc.password}",    "hive.sql.table" = 
"\"Country\"")fname=jdbc_case_sensitive_table_postgres.q
See ./ql/target/tmp/log/hive.log or ./itests/qtest/target/tmp/log/hive.log, or 
check ./ql/target/surefire-reports or ./itests/qtest/target/surefire-reports/ 
for specific test cases logs. org.apache.hadoop.hive.ql.metadata.HiveException: 
Exception occurred while getting the URI from storage handler: Illegal 
character in opaque part at index 37: 
jdbc:postgresql://localhost:5432/qdb/"Country"        at 
org.apache.hadoop.hive.ql.security.authorization.command.CommandAuthorizerV2.addHivePrivObject(CommandAuthorizerV2.java:213)
 at 
org.apache.hadoop.hive.ql.security.authorization.command.CommandAuthorizerV2.getHivePrivObjects(CommandAuthorizerV2.java:152)
        at 
org.apache.hadoop.hive.ql.security.authorization.command.CommandAuthorizerV2.doAuthorization(CommandAuthorizerV2.java:77)
    at 
org.apache.hadoop.hive.ql.security.authorization.command.CommandAuthorizer.doAuthorization(CommandAuthorizer.java:58)
        at 
org.apache.hadoop.hive.ql.Compiler.authorize(Compiler.java:440){noformat}

And when it is disabled, we see:
{noformat}
[ERROR] Failures:[ERROR]   TestMiniLlapLocalCliDriver.testCliDriver:62 Client 
execution failed with error code = 40000running
SELECT * FROM country ORDER BY idfname=jdbc_case_sensitive_table_postgres.q
See ./ql/target/tmp/log/hive.log or ./itests/qtest/target/tmp/log/hive.log, or 
check ./ql/target/surefire-reports or ./itests/qtest/target/surefire-reports/ 
for specific test cases logs. 
org.apache.hadoop.hive.ql.parse.SemanticException: Table "Country" was not 
found in the database     at 
org.apache.hadoop.hive.ql.parse.CalcitePlanner$CalcitePlannerAction.genTableLogicalPlan(CalcitePlanner.java:3220)
    at 
org.apache.hadoop.hive.ql.parse.CalcitePlanner$CalcitePlannerAction.genLogicalPlan(CalcitePlanner.java:4937)
 at 
org.apache.hadoop.hive.ql.parse.CalcitePlanner$CalcitePlannerAction.apply(CalcitePlanner.java:1630)
  at 
org.apache.hadoop.hive.ql.parse.CalcitePlanner$CalcitePlannerAction.apply(CalcitePlanner.java:1573)
  at 
org.apache.calcite.tools.Frameworks.lambda$withPlanner$0(Frameworks.java:140)   
     at 
org.apache.calcite.prepare.CalcitePrepareImpl.perform(CalcitePrepareImpl.java:936){noformat}



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

Reply via email to