[ https://issues.apache.org/jira/browse/HIVE-18268?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16293006#comment-16293006 ]
Hive QA commented on HIVE-18268: -------------------------------- | (x) *{color:red}-1 overall{color}* | \\ \\ || Vote || Subsystem || Runtime || Comment || || || || || {color:brown} Prechecks {color} || | {color:blue}0{color} | {color:blue} findbugs {color} | {color:blue} 0m 1s{color} | {color:blue} Findbugs executables are not available. {color} | | {color:green}+1{color} | {color:green} @author {color} | {color:green} 0m 0s{color} | {color:green} The patch does not contain any @author tags. {color} | || || || || {color:brown} master Compile Tests {color} || | {color:green}+1{color} | {color:green} mvninstall {color} | {color:green} 6m 56s{color} | {color:green} master passed {color} | | {color:green}+1{color} | {color:green} compile {color} | {color:green} 0m 16s{color} | {color:green} master passed {color} | | {color:green}+1{color} | {color:green} checkstyle {color} | {color:green} 0m 11s{color} | {color:green} master passed {color} | | {color:green}+1{color} | {color:green} javadoc {color} | {color:green} 0m 13s{color} | {color:green} master passed {color} | || || || || {color:brown} Patch Compile Tests {color} || | {color:green}+1{color} | {color:green} mvninstall {color} | {color:green} 0m 46s{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} compile {color} | {color:green} 0m 18s{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} javac {color} | {color:green} 0m 18s{color} | {color:green} the patch passed {color} | | {color:red}-1{color} | {color:red} checkstyle {color} | {color:red} 0m 11s{color} | {color:red} jdbc: The patch generated 1 new + 16 unchanged - 2 fixed = 17 total (was 18) {color} | | {color:red}-1{color} | {color:red} whitespace {color} | {color:red} 0m 0s{color} | {color:red} The patch 10 line(s) with tabs. {color} | | {color:green}+1{color} | {color:green} javadoc {color} | {color:green} 0m 12s{color} | {color:green} the patch passed {color} | || || || || {color:brown} Other Tests {color} || | {color:green}+1{color} | {color:green} asflicense {color} | {color:green} 0m 11s{color} | {color:green} The patch does not generate ASF License warnings. {color} | | {color:black}{color} | {color:black} {color} | {color:black} 9m 31s{color} | {color:black} {color} | \\ \\ || Subsystem || Report/Notes || | Optional Tests | asflicense javac javadoc findbugs checkstyle compile | | uname | Linux hiveptest-server-upstream 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u1 (2016-09-03) x86_64 GNU/Linux | | Build tool | maven | | Personality | /data/hiveptest/working/yetus/dev-support/hive-personality.sh | | git revision | master / f52e8b4 | | Default Java | 1.8.0_111 | | checkstyle | http://104.198.109.242/logs//PreCommit-HIVE-Build-8272/yetus/diff-checkstyle-jdbc.txt | | whitespace | http://104.198.109.242/logs//PreCommit-HIVE-Build-8272/yetus/whitespace-tabs.txt | | modules | C: jdbc U: jdbc | | Console output | http://104.198.109.242/logs//PreCommit-HIVE-Build-8272/yetus.txt | | Powered by | Apache Yetus http://yetus.apache.org | This message was automatically generated. > 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.2.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)