[ https://issues.apache.org/jira/browse/HIVE-15820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15889567#comment-15889567 ]
Hive QA commented on HIVE-15820: -------------------------------- Here are the results of testing the latest attachment: https://issues.apache.org/jira/secure/attachment/12853949/HIVE-15820.patch {color:red}ERROR:{color} -1 due to build exiting with an error Test results: https://builds.apache.org/job/PreCommit-HIVE-Build/3858/testReport Console output: https://builds.apache.org/job/PreCommit-HIVE-Build/3858/console Test logs: http://104.198.109.242/logs/PreCommit-HIVE-Build-3858/ Messages: {noformat} Executing org.apache.hive.ptest.execution.TestCheckPhase Executing org.apache.hive.ptest.execution.PrepPhase Tests exited with: NonZeroExitCodeException Command 'bash /data/hiveptest/working/scratch/source-prep.sh' failed with exit status 1 and output '+ date '+%Y-%m-%d %T.%3N' 2017-03-01 06:06:45.302 + [[ -n /usr/lib/jvm/java-8-openjdk-amd64 ]] + export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 + JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 + export PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin/:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin/:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games + export 'ANT_OPTS=-Xmx1g -XX:MaxPermSize=256m ' + ANT_OPTS='-Xmx1g -XX:MaxPermSize=256m ' + export 'MAVEN_OPTS=-Xmx1g ' + MAVEN_OPTS='-Xmx1g ' + cd /data/hiveptest/working/ + tee /data/hiveptest/logs/PreCommit-HIVE-Build-3858/source-prep.txt + [[ false == \t\r\u\e ]] + mkdir -p maven ivy + [[ git = \s\v\n ]] + [[ git = \g\i\t ]] + [[ -z master ]] + [[ -d apache-github-source-source ]] + [[ ! -d apache-github-source-source/.git ]] + [[ ! -d apache-github-source-source ]] + date '+%Y-%m-%d %T.%3N' 2017-03-01 06:06:45.305 + cd apache-github-source-source + git fetch origin + git reset --hard HEAD HEAD is now at a9de1cd HIVE-16047: Shouldn't try to get KeyProvider unless encryption is enabled (Rui reviewed by Xuefu and Ferdinand) + git clean -f -d + git checkout master Already on 'master' Your branch is up-to-date with 'origin/master'. + git reset --hard origin/master HEAD is now at a9de1cd HIVE-16047: Shouldn't try to get KeyProvider unless encryption is enabled (Rui reviewed by Xuefu and Ferdinand) + git merge --ff-only origin/master Already up-to-date. + date '+%Y-%m-%d %T.%3N' 2017-03-01 06:06:46.294 + patchCommandPath=/data/hiveptest/working/scratch/smart-apply-patch.sh + patchFilePath=/data/hiveptest/working/scratch/build.patch + [[ -f /data/hiveptest/working/scratch/build.patch ]] + chmod +x /data/hiveptest/working/scratch/smart-apply-patch.sh + /data/hiveptest/working/scratch/smart-apply-patch.sh /data/hiveptest/working/scratch/build.patch error: patch failed: beeline/src/java/org/apache/hive/beeline/Commands.java:795 error: beeline/src/java/org/apache/hive/beeline/Commands.java: patch does not apply The patch does not appear to apply with p0, p1, or p2 + exit 1 ' {noformat} This message is automatically generated. ATTACHMENT ID: 12853949 - PreCommit-HIVE-Build > comment at the head of beeline -e > --------------------------------- > > Key: HIVE-15820 > URL: https://issues.apache.org/jira/browse/HIVE-15820 > Project: Hive > Issue Type: Bug > Components: Beeline > Affects Versions: 1.2.1, 2.1.1 > Reporter: muxin > Assignee: muxin > Labels: patch > Attachments: HIVE-15820.patch > > > $ beeline -u jdbc:hive2://localhost:10000 -n test -e " > > --asdfasdfasdfasdf > > select * from test_table; > > " > expected result of the above command should be all rows of test_table(same as > run in beeline interactive mode),but it does not output anything. > the cause is that -e option will read commands as one string, and in method > dispatch(String line) it calls function isComment(String line) in the first, > which using > 'lineTrimmed.startsWith("#") || lineTrimmed.startsWith("--")' > to regard commands as a comment. > two ways can be considered to fix this problem: > 1. in method initArgs(String[] args), split command by '\n' into command list > before dispatch when cl.getOptionValues('e') != null > 2. in method dispatch(String line), remove comments using this: > static String removeComments(String line) { > if (line == null || line.isEmpty()) { > return line; > } > StringBuilder builder = new StringBuilder(); > int escape = -1; > for (int index = 0; index < line.length(); index++) { > if (index < line.length() - 1 && line.charAt(index) == > line.charAt(index + 1)) { > if (escape == -1 && line.charAt(index) == '-') { > //find \n as the end of comment > index = line.indexOf('\n',index+1); > //there is no sql after this comment,so just break out > if (-1==index){ > break; > } > } > } > char letter = line.charAt(index); > if (letter == escape) { > escape = -1; // Turn escape off. > } else if (escape == -1 && (letter == '\'' || letter == '"')) { > escape = letter; // Turn escape on. > } > builder.append(letter); > } > return builder.toString(); > } > the second way can be a general solution to remove all comments start with > '--' in a sql -- This message was sent by Atlassian JIRA (v6.3.15#6346)