[
https://issues.apache.org/jira/browse/PIG-4452?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Daniel Dai updated PIG-4452:
----------------------------
Resolution: Fixed
Hadoop Flags: Reviewed
Status: Resolved (was: Patch Available)
Patch committed to both branch 0.15 and trunk. Thanks Rohini for review!
> Embedded SQL using "SQL" instead of "sql" fails with string index out of
> range: -1 error
> ----------------------------------------------------------------------------------------
>
> Key: PIG-4452
> URL: https://issues.apache.org/jira/browse/PIG-4452
> Project: Pig
> Issue Type: Bug
> Components: grunt, parser
> Affects Versions: 0.12.0
> Reporter: Brian Kessler
> Assignee: Daniel Dai
> Priority: Minor
> Fix For: 0.15.0
>
> Attachments: PIG-4452-1.patch
>
>
> The embedded SQL command is case sensitive and fails with an string index out
> of range error that is not helpful for determining the cause of the failure.
> grunt> SQL CREATE TABLE bk_test(col1 STRING);
> 2015-03-06 17:47:19,416 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR
> 2999: Unexpected internal error. String index out of range: -1
> grunt> sql CREATE TABLE bk_test(col1 STRING);
> 2015-03-06 17:49:47,219 [main] INFO org.apache.pig.tools.grunt.GruntParser -
> Going to run hcat command: create table bk_test(col1 STRING);
> The issue is possibly in this section of code implementing embedded SQL as
> part of PIG-2482 looking for indexOf("sql") which would return -1 on "SQL":
> + public static int runSQLCommand(String hcatBin, String cmd, boolean
> mInteractive) throws IOException {
> + String[] tokens = new String[3];
> + tokens[0] = hcatBin;
> + tokens[1] = "-e";
> + tokens[2] = cmd.substring(cmd.indexOf("sql")).substring(4);
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)