hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hive QA (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-18268) Hive Prepared Statement when split with double quoted in query fails
Date Thu, 14 Dec 2017 20:02:00 GMT

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

Hive QA commented on HIVE-18268:
--------------------------------



Here are the results of testing the latest attachment:
https://issues.apache.org/jira/secure/attachment/12902012/HIVE-18268.1.patch

{color:green}SUCCESS:{color} +1 due to 1 test(s) being added or modified.

{color:red}ERROR:{color} -1 due to 18 failed/errored test(s), 11530 tests executed
*Failed tests:*
{noformat}
org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver[auto_sortmerge_join_2] (batchId=48)
org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver[ppd_join5] (batchId=35)
org.apache.hadoop.hive.cli.TestMiniLlapLocalCliDriver.testCliDriver[bucketsortoptimize_insert_2]
(batchId=152)
org.apache.hadoop.hive.cli.TestMiniLlapLocalCliDriver.testCliDriver[hybridgrace_hashjoin_2]
(batchId=157)
org.apache.hadoop.hive.cli.TestMiniLlapLocalCliDriver.testCliDriver[insert_values_orig_table_use_metadata]
(batchId=165)
org.apache.hadoop.hive.cli.TestMiniLlapLocalCliDriver.testCliDriver[llap_acid] (batchId=169)
org.apache.hadoop.hive.cli.TestMiniLlapLocalCliDriver.testCliDriver[llap_acid_fast] (batchId=160)
org.apache.hadoop.hive.cli.TestMiniLlapLocalCliDriver.testCliDriver[quotedid_smb] (batchId=157)
org.apache.hadoop.hive.cli.TestMiniLlapLocalCliDriver.testCliDriver[sysdb] (batchId=160)
org.apache.hadoop.hive.cli.TestNegativeCliDriver.testCliDriver[authorization_alter_table_exchange_partition_fail]
(batchId=93)
org.apache.hadoop.hive.cli.TestNegativeCliDriver.testCliDriver[authorization_part] (batchId=93)
org.apache.hadoop.hive.cli.TestNegativeCliDriver.testCliDriver[stats_aggregator_error_1] (batchId=93)
org.apache.hadoop.hive.cli.TestSparkCliDriver.testCliDriver[auto_sortmerge_join_10] (batchId=138)
org.apache.hadoop.hive.cli.TestSparkCliDriver.testCliDriver[bucketsortoptimize_insert_7] (batchId=128)
org.apache.hadoop.hive.cli.TestSparkCliDriver.testCliDriver[ppd_join5] (batchId=120)
org.apache.hadoop.hive.cli.TestSparkCliDriver.testCliDriver[subquery_multi] (batchId=113)
org.apache.hadoop.hive.ql.parse.TestReplicationScenarios.testConstraints (batchId=226)
org.apache.hive.jdbc.TestJdbcDriver2.testPrepareStatement (batchId=234)
{noformat}

Test results: https://builds.apache.org/job/PreCommit-HIVE-Build/8245/testReport
Console output: https://builds.apache.org/job/PreCommit-HIVE-Build/8245/console
Test logs: http://104.198.109.242/logs/PreCommit-HIVE-Build-8245/

Messages:
{noformat}
Executing org.apache.hive.ptest.execution.TestCheckPhase
Executing org.apache.hive.ptest.execution.PrepPhase
Executing org.apache.hive.ptest.execution.YetusPhase
Executing org.apache.hive.ptest.execution.ExecutionPhase
Executing org.apache.hive.ptest.execution.ReportingPhase
Tests exited with: TestsFailedException: 18 tests failed
{noformat}

This message is automatically generated.

ATTACHMENT ID: 12902012 - PreCommit-HIVE-Build

> Hive Prepared Statement when split with double quoted in query fails
> --------------------------------------------------------------------
>
>                 Key: HIVE-18268
>                 URL: https://issues.apache.org/jira/browse/HIVE-18268
>             Project: Hive
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 2.3.2
>            Reporter: Choi JaeHwan
>            Assignee: Choi JaeHwan
>             Fix For: 2.3.3
>
>         Attachments: HIVE-18268.1.patch, HIVE-18268.patch
>
>
> HIVE-13625, Change sql statement split when odd number of escape characters, and add
parameter counter validation, above 
> {code:java}
> // prev code
>     StringBuilder newSql = new StringBuilder(parts.get(0));
>     for(int i=1;i<parts.size();i++){
>       if(!parameters.containsKey(i)){
>         throw new SQLException("Parameter #"+i+" is unset");
>       }
>       newSql.append(parameters.get(i));
>       newSql.append(parts.get(i));
>     }
> // change from HIVE-13625
>     int paramLoc = 1;
>     while (getCharIndexFromSqlByParamLocation(sql, '?', paramLoc) > 0) {
>       // check the user has set the needs parameters
>       if (parameters.containsKey(paramLoc)) {
>         int tt = getCharIndexFromSqlByParamLocation(newSql.toString(), '?', 1);
>         newSql.deleteCharAt(tt);
>         newSql.insert(tt, parameters.get(paramLoc));
>       }
>       paramLoc++;
>     }
> {code}
> If the number of split SQL and the number of parameters are not matched, an SQLException
is thrown
> Currently, when splitting SQL, there is no processing for double quoted, and when the
token ('?' ) is between double quote, SQL is split.
> i think when the token between double quoted is literal, it is correct to not split.
> for example, above the query;
> {code:java}
> // Some comments here
> 1:  String query =  " select 1 from x where qa="?" "
> 2:  String query = " SELECT 1 FROM `x` WHERE (trecord LIKE "ALA[d_?]%")
> {code}
> ? is literal, then query do not split. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message