[jira] [Updated] (SQOOP-3061) Sqoop --options-file failed with error "Malformed option in options file" even though the query is correct

2017-06-15 Thread Attila Szabo (JIRA)

 [ 
https://issues.apache.org/jira/browse/SQOOP-3061?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Attila Szabo updated SQOOP-3061:

Fix Version/s: 1.4.7

> Sqoop --options-file failed with error "Malformed option in options file" 
> even though the query is correct
> --
>
> Key: SQOOP-3061
> URL: https://issues.apache.org/jira/browse/SQOOP-3061
> Project: Sqoop
>  Issue Type: Bug
>Affects Versions: 1.4.6
>Reporter: Eric Lin
>Assignee: Eric Lin
>Priority: Minor
>  Labels: patch
> Fix For: 1.4.7
>
> Attachments: SQOOP-3061.2.patch, SQOOP-3061.3.patch, 
> SQOOP-3061.4.patch, SQOOP-3061.5.patch, SQOOP-3061.patch
>
>
> if you have the following in the options file:
> --query
> SELECT * FROM test WHERE a = 'b'
> and then run 
> {code}
> sqoop --options-file 
> {code}
> it will fail with the following error:
> {code}
> 16/11/22 16:08:59 ERROR sqoop.Sqoop: Error while expanding arguments
> java.lang.Exception: Malformed option in options 
> file(/tmp/sqoop_runner_from_stdin_1112_12354__sqoop_options_file): SELECT * 
> FROM test WHERE a = 'b'
> at 
> org.apache.sqoop.util.OptionsFileUtil.removeQuoteCharactersIfNecessary(OptionsFileUtil.java:170)
> at 
> org.apache.sqoop.util.OptionsFileUtil.removeQuotesEncolosingOption(OptionsFileUtil.java:136)
> at 
> org.apache.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:90)
> at 
> com.cloudera.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:33)
> at org.apache.sqoop.Sqoop.runTool(Sqoop.java:199)
> at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
> at org.apache.sqoop.Sqoop.main(Sqoop.java:236)
> Malformed option in options 
> file(/tmp/sqoop_runner_from_stdin_1112_12354__sqoop_options_file): SELECT * 
> FROM test WHERE a = 'b'
> {code}
> This is caused by function 
> org.apache.sqoop.util.OptionsFileUtil.removeQuoteCharactersIfNecessary only 
> checks for starting and ending quotes and will fail if the query does not 
> start with a quote but ends with a quote, like the example query above.
> {code}
>   private static String removeQuoteCharactersIfNecessary(String fileName,
>   String option, char quote) throws Exception {
> boolean startingQuote = (option.charAt(0) == quote);
> boolean endingQuote = (option.charAt(option.length() - 1) == quote);
> if (startingQuote && endingQuote) {
>   if (option.length() == 1) {
> throw new Exception("Malformed option in options file("
> + fileName + "): " + option);
>   }
>   return option.substring(1, option.length() - 1);
> }
> if (startingQuote || endingQuote) {
>throw new Exception("Malformed option in options file("
>+ fileName + "): " + option);
> }
> return option;
>   }
> {code}



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


[jira] [Updated] (SQOOP-3061) Sqoop --options-file failed with error "Malformed option in options file" even though the query is correct

2017-01-18 Thread Eric Lin (JIRA)

 [ 
https://issues.apache.org/jira/browse/SQOOP-3061?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Lin updated SQOOP-3061:

Attachment: SQOOP-3061.5.patch

Latest patch based on review - SQOOP-3061.5.patch

> Sqoop --options-file failed with error "Malformed option in options file" 
> even though the query is correct
> --
>
> Key: SQOOP-3061
> URL: https://issues.apache.org/jira/browse/SQOOP-3061
> Project: Sqoop
>  Issue Type: Bug
>Affects Versions: 1.4.6
>Reporter: Eric Lin
>Assignee: Eric Lin
>Priority: Minor
>  Labels: patch
> Attachments: SQOOP-3061.2.patch, SQOOP-3061.3.patch, 
> SQOOP-3061.4.patch, SQOOP-3061.5.patch, SQOOP-3061.patch
>
>
> if you have the following in the options file:
> --query
> SELECT * FROM test WHERE a = 'b'
> and then run 
> {code}
> sqoop --options-file 
> {code}
> it will fail with the following error:
> {code}
> 16/11/22 16:08:59 ERROR sqoop.Sqoop: Error while expanding arguments
> java.lang.Exception: Malformed option in options 
> file(/tmp/sqoop_runner_from_stdin_1112_12354__sqoop_options_file): SELECT * 
> FROM test WHERE a = 'b'
> at 
> org.apache.sqoop.util.OptionsFileUtil.removeQuoteCharactersIfNecessary(OptionsFileUtil.java:170)
> at 
> org.apache.sqoop.util.OptionsFileUtil.removeQuotesEncolosingOption(OptionsFileUtil.java:136)
> at 
> org.apache.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:90)
> at 
> com.cloudera.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:33)
> at org.apache.sqoop.Sqoop.runTool(Sqoop.java:199)
> at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
> at org.apache.sqoop.Sqoop.main(Sqoop.java:236)
> Malformed option in options 
> file(/tmp/sqoop_runner_from_stdin_1112_12354__sqoop_options_file): SELECT * 
> FROM test WHERE a = 'b'
> {code}
> This is caused by function 
> org.apache.sqoop.util.OptionsFileUtil.removeQuoteCharactersIfNecessary only 
> checks for starting and ending quotes and will fail if the query does not 
> start with a quote but ends with a quote, like the example query above.
> {code}
>   private static String removeQuoteCharactersIfNecessary(String fileName,
>   String option, char quote) throws Exception {
> boolean startingQuote = (option.charAt(0) == quote);
> boolean endingQuote = (option.charAt(option.length() - 1) == quote);
> if (startingQuote && endingQuote) {
>   if (option.length() == 1) {
> throw new Exception("Malformed option in options file("
> + fileName + "): " + option);
>   }
>   return option.substring(1, option.length() - 1);
> }
> if (startingQuote || endingQuote) {
>throw new Exception("Malformed option in options file("
>+ fileName + "): " + option);
> }
> return option;
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (SQOOP-3061) Sqoop --options-file failed with error "Malformed option in options file" even though the query is correct

2017-01-08 Thread Eric Lin (JIRA)

 [ 
https://issues.apache.org/jira/browse/SQOOP-3061?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Lin updated SQOOP-3061:

Attachment: SQOOP-3061.4.patch

Latest patch based on review

> Sqoop --options-file failed with error "Malformed option in options file" 
> even though the query is correct
> --
>
> Key: SQOOP-3061
> URL: https://issues.apache.org/jira/browse/SQOOP-3061
> Project: Sqoop
>  Issue Type: Bug
>Affects Versions: 1.4.6
>Reporter: Eric Lin
>Assignee: Eric Lin
>Priority: Minor
>  Labels: patch
> Attachments: SQOOP-3061.2.patch, SQOOP-3061.3.patch, 
> SQOOP-3061.4.patch, SQOOP-3061.patch
>
>
> if you have the following in the options file:
> --query
> SELECT * FROM test WHERE a = 'b'
> and then run 
> {code}
> sqoop --options-file 
> {code}
> it will fail with the following error:
> {code}
> 16/11/22 16:08:59 ERROR sqoop.Sqoop: Error while expanding arguments
> java.lang.Exception: Malformed option in options 
> file(/tmp/sqoop_runner_from_stdin_1112_12354__sqoop_options_file): SELECT * 
> FROM test WHERE a = 'b'
> at 
> org.apache.sqoop.util.OptionsFileUtil.removeQuoteCharactersIfNecessary(OptionsFileUtil.java:170)
> at 
> org.apache.sqoop.util.OptionsFileUtil.removeQuotesEncolosingOption(OptionsFileUtil.java:136)
> at 
> org.apache.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:90)
> at 
> com.cloudera.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:33)
> at org.apache.sqoop.Sqoop.runTool(Sqoop.java:199)
> at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
> at org.apache.sqoop.Sqoop.main(Sqoop.java:236)
> Malformed option in options 
> file(/tmp/sqoop_runner_from_stdin_1112_12354__sqoop_options_file): SELECT * 
> FROM test WHERE a = 'b'
> {code}
> This is caused by function 
> org.apache.sqoop.util.OptionsFileUtil.removeQuoteCharactersIfNecessary only 
> checks for starting and ending quotes and will fail if the query does not 
> start with a quote but ends with a quote, like the example query above.
> {code}
>   private static String removeQuoteCharactersIfNecessary(String fileName,
>   String option, char quote) throws Exception {
> boolean startingQuote = (option.charAt(0) == quote);
> boolean endingQuote = (option.charAt(option.length() - 1) == quote);
> if (startingQuote && endingQuote) {
>   if (option.length() == 1) {
> throw new Exception("Malformed option in options file("
> + fileName + "): " + option);
>   }
>   return option.substring(1, option.length() - 1);
> }
> if (startingQuote || endingQuote) {
>throw new Exception("Malformed option in options file("
>+ fileName + "): " + option);
> }
> return option;
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (SQOOP-3061) Sqoop --options-file failed with error "Malformed option in options file" even though the query is correct

2016-12-08 Thread Eric Lin (JIRA)

 [ 
https://issues.apache.org/jira/browse/SQOOP-3061?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Lin updated SQOOP-3061:

Attachment: SQOOP-3061.3.patch

Based on latest review feedback from [~maugli], I have made some changes.

> Sqoop --options-file failed with error "Malformed option in options file" 
> even though the query is correct
> --
>
> Key: SQOOP-3061
> URL: https://issues.apache.org/jira/browse/SQOOP-3061
> Project: Sqoop
>  Issue Type: Bug
>Affects Versions: 1.4.6
>Reporter: Eric Lin
>Priority: Minor
>  Labels: patch
> Attachments: SQOOP-3061.2.patch, SQOOP-3061.3.patch, SQOOP-3061.patch
>
>
> if you have the following in the options file:
> --query
> SELECT * FROM test WHERE a = 'b'
> and then run 
> {code}
> sqoop --options-file 
> {code}
> it will fail with the following error:
> {code}
> 16/11/22 16:08:59 ERROR sqoop.Sqoop: Error while expanding arguments
> java.lang.Exception: Malformed option in options 
> file(/tmp/sqoop_runner_from_stdin_1112_12354__sqoop_options_file): SELECT * 
> FROM test WHERE a = 'b'
> at 
> org.apache.sqoop.util.OptionsFileUtil.removeQuoteCharactersIfNecessary(OptionsFileUtil.java:170)
> at 
> org.apache.sqoop.util.OptionsFileUtil.removeQuotesEncolosingOption(OptionsFileUtil.java:136)
> at 
> org.apache.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:90)
> at 
> com.cloudera.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:33)
> at org.apache.sqoop.Sqoop.runTool(Sqoop.java:199)
> at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
> at org.apache.sqoop.Sqoop.main(Sqoop.java:236)
> Malformed option in options 
> file(/tmp/sqoop_runner_from_stdin_1112_12354__sqoop_options_file): SELECT * 
> FROM test WHERE a = 'b'
> {code}
> This is caused by function 
> org.apache.sqoop.util.OptionsFileUtil.removeQuoteCharactersIfNecessary only 
> checks for starting and ending quotes and will fail if the query does not 
> start with a quote but ends with a quote, like the example query above.
> {code}
>   private static String removeQuoteCharactersIfNecessary(String fileName,
>   String option, char quote) throws Exception {
> boolean startingQuote = (option.charAt(0) == quote);
> boolean endingQuote = (option.charAt(option.length() - 1) == quote);
> if (startingQuote && endingQuote) {
>   if (option.length() == 1) {
> throw new Exception("Malformed option in options file("
> + fileName + "): " + option);
>   }
>   return option.substring(1, option.length() - 1);
> }
> if (startingQuote || endingQuote) {
>throw new Exception("Malformed option in options file("
>+ fileName + "): " + option);
> }
> return option;
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (SQOOP-3061) Sqoop --options-file failed with error "Malformed option in options file" even though the query is correct

2016-11-24 Thread Eric Lin (JIRA)

 [ 
https://issues.apache.org/jira/browse/SQOOP-3061?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Lin updated SQOOP-3061:

Description: 
if you have the following in the options file:

--query
SELECT * FROM test WHERE a = 'b'

and then run 

{code}
sqoop --options-file 
{code}

it will fail with the following error:

{code}
16/11/22 16:08:59 ERROR sqoop.Sqoop: Error while expanding arguments
java.lang.Exception: Malformed option in options 
file(/tmp/sqoop_runner_from_stdin_1112_12354__sqoop_options_file): SELECT * 
FROM test WHERE a = 'b'
at 
org.apache.sqoop.util.OptionsFileUtil.removeQuoteCharactersIfNecessary(OptionsFileUtil.java:170)
at 
org.apache.sqoop.util.OptionsFileUtil.removeQuotesEncolosingOption(OptionsFileUtil.java:136)
at 
org.apache.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:90)
at 
com.cloudera.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:33)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:199)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
at org.apache.sqoop.Sqoop.main(Sqoop.java:236)
Malformed option in options 
file(/tmp/sqoop_runner_from_stdin_1112_12354__sqoop_options_file): SELECT * 
FROM test WHERE a = 'b'
{code}

This is caused by function 
org.apache.sqoop.util.OptionsFileUtil.removeQuoteCharactersIfNecessary only 
checks for starting and ending quotes and will fail if the query does not start 
with a quote but ends with a quote, like the example query above.

{code}
  private static String removeQuoteCharactersIfNecessary(String fileName,
  String option, char quote) throws Exception {
boolean startingQuote = (option.charAt(0) == quote);
boolean endingQuote = (option.charAt(option.length() - 1) == quote);

if (startingQuote && endingQuote) {
  if (option.length() == 1) {
throw new Exception("Malformed option in options file("
+ fileName + "): " + option);
  }
  return option.substring(1, option.length() - 1);
}

if (startingQuote || endingQuote) {
   throw new Exception("Malformed option in options file("
   + fileName + "): " + option);
}

return option;
  }
{code}

  was:
if you have the following in the options file:

--query
SELECT * FROM test WHERE a = 'b'

and then run 

{code}
sqoop --options-file 
{code}

it will fail with the following error:

{code}
16/11/22 16:08:59 ERROR sqoop.Sqoop: Error while expanding arguments
java.lang.Exception: Malformed option in options 
file(/tmp/sqoop_runner_from_stdin_1112_12354__sqoop_options_file): SELECT * 
FROM test WHERE a = 'b'
at 
org.apache.sqoop.util.OptionsFileUtil.removeQuoteCharactersIfNecessary(OptionsFileUtil.java:170)
at 
org.apache.sqoop.util.OptionsFileUtil.removeQuotesEncolosingOption(OptionsFileUtil.java:136)
at 
org.apache.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:90)
at 
com.cloudera.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:33)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:199)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
at org.apache.sqoop.Sqoop.main(Sqoop.java:236)
Malformed option in options 
file(/tmp/sqoop_runner_from_stdin_1112_12354__sqoop_options_file): SELECT * 
FROM test WHERE a = 'b'
{code}

This is caused by function 
org.apache.sqoop.util.OptionsFileUtil.removeQuoteCharactersIfNecessary only 
checks for starting and ending quotes and will fail if the query does not start 
with a quote but ends with a quote, like the example query above.


> Sqoop --options-file failed with error "Malformed option in options file" 
> even though the query is correct
> --
>
> Key: SQOOP-3061
> URL: https://issues.apache.org/jira/browse/SQOOP-3061
> Project: Sqoop
>  Issue Type: Bug
>Affects Versions: 1.4.6
>Reporter: Eric Lin
>Priority: Minor
>  Labels: patch
> Attachments: SQOOP-3061.patch
>
>
> if you have the following in the options file:
> --query
> SELECT * FROM test WHERE a = 'b'
> and then run 
> {code}
> sqoop --options-file 
> {code}
> it will fail with the following error:
> {code}
> 16/11/22 16:08:59 ERROR sqoop.Sqoop: Error while expanding arguments
> java.lang.Exception: Malformed option in options 
> file(/tmp/sqoop_runner_from_stdin_1112_12354__sqoop_options_file): SELECT * 
> FROM test WHERE a = 'b'
> at 
> org.apache.sqoop.util.OptionsFileUtil.removeQuoteCharactersIfNecessary(OptionsFileUtil.java:170)
> at 
> org.apache.sqoop.util.OptionsFileUtil.removeQuotesEncolosingOption(OptionsFileUtil.java:136)
> at 
> org.apache.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:90)
> at 
> com.cloudera.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:33)
> at org.apache.sqoop.Sqoop.runTool(Sqoop.java:199)
> at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)

[jira] [Updated] (SQOOP-3061) Sqoop --options-file failed with error "Malformed option in options file" even though the query is correct

2016-11-24 Thread Eric Lin (JIRA)

 [ 
https://issues.apache.org/jira/browse/SQOOP-3061?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Lin updated SQOOP-3061:

Description: 
if you have the following in the options file:

--query
SELECT * FROM test WHERE a = 'b'

and then run 

{code}
sqoop --options-file 
{code}

it will fail with the following error:

{code}
16/11/22 16:08:59 ERROR sqoop.Sqoop: Error while expanding arguments
java.lang.Exception: Malformed option in options 
file(/tmp/sqoop_runner_from_stdin_1112_12354__sqoop_options_file): SELECT * 
FROM test WHERE a = 'b'
at 
org.apache.sqoop.util.OptionsFileUtil.removeQuoteCharactersIfNecessary(OptionsFileUtil.java:170)
at 
org.apache.sqoop.util.OptionsFileUtil.removeQuotesEncolosingOption(OptionsFileUtil.java:136)
at 
org.apache.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:90)
at 
com.cloudera.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:33)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:199)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
at org.apache.sqoop.Sqoop.main(Sqoop.java:236)
Malformed option in options 
file(/tmp/sqoop_runner_from_stdin_1112_12354__sqoop_options_file): SELECT * 
FROM test WHERE a = 'b'
{code}

This is caused by function 
org.apache.sqoop.util.OptionsFileUtil.removeQuoteCharactersIfNecessary only 
checks for starting and ending quotes and will fail if the query does not start 
with a quote but ends with a quote, like the example query above.

  was:
if you have the following in the options file:

--query
SELECT * FROM test WHERE a = 'b'

it will fail with the following error:

{code}
16/11/22 16:08:59 ERROR sqoop.Sqoop: Error while expanding arguments
java.lang.Exception: Malformed option in options 
file(/tmp/sqoop_runner_from_stdin_1112_12354__sqoop_options_file): SELECT * 
FROM test WHERE a = 'b'
at 
org.apache.sqoop.util.OptionsFileUtil.removeQuoteCharactersIfNecessary(OptionsFileUtil.java:170)
at 
org.apache.sqoop.util.OptionsFileUtil.removeQuotesEncolosingOption(OptionsFileUtil.java:136)
at 
org.apache.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:90)
at 
com.cloudera.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:33)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:199)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
at org.apache.sqoop.Sqoop.main(Sqoop.java:236)
Malformed option in options 
file(/tmp/sqoop_runner_from_stdin_1112_12354__sqoop_options_file): SELECT * 
FROM test WHERE a = 'b'
{code}

This is caused by function 
org.apache.sqoop.util.OptionsFileUtil.removeQuoteCharactersIfNecessary only 
checks for starting and ending quotes and will fail if the query does not start 
with a quote but ends with a quote, like the example query above.


> Sqoop --options-file failed with error "Malformed option in options file" 
> even though the query is correct
> --
>
> Key: SQOOP-3061
> URL: https://issues.apache.org/jira/browse/SQOOP-3061
> Project: Sqoop
>  Issue Type: Bug
>Affects Versions: 1.4.6
>Reporter: Eric Lin
>Priority: Minor
>  Labels: patch
> Attachments: SQOOP-3061.patch
>
>
> if you have the following in the options file:
> --query
> SELECT * FROM test WHERE a = 'b'
> and then run 
> {code}
> sqoop --options-file 
> {code}
> it will fail with the following error:
> {code}
> 16/11/22 16:08:59 ERROR sqoop.Sqoop: Error while expanding arguments
> java.lang.Exception: Malformed option in options 
> file(/tmp/sqoop_runner_from_stdin_1112_12354__sqoop_options_file): SELECT * 
> FROM test WHERE a = 'b'
> at 
> org.apache.sqoop.util.OptionsFileUtil.removeQuoteCharactersIfNecessary(OptionsFileUtil.java:170)
> at 
> org.apache.sqoop.util.OptionsFileUtil.removeQuotesEncolosingOption(OptionsFileUtil.java:136)
> at 
> org.apache.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:90)
> at 
> com.cloudera.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:33)
> at org.apache.sqoop.Sqoop.runTool(Sqoop.java:199)
> at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
> at org.apache.sqoop.Sqoop.main(Sqoop.java:236)
> Malformed option in options 
> file(/tmp/sqoop_runner_from_stdin_1112_12354__sqoop_options_file): SELECT * 
> FROM test WHERE a = 'b'
> {code}
> This is caused by function 
> org.apache.sqoop.util.OptionsFileUtil.removeQuoteCharactersIfNecessary only 
> checks for starting and ending quotes and will fail if the query does not 
> start with a quote but ends with a quote, like the example query above.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (SQOOP-3061) Sqoop --options-file failed with error "Malformed option in options file" even though the query is correct

2016-11-24 Thread Eric Lin (JIRA)

 [ 
https://issues.apache.org/jira/browse/SQOOP-3061?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Lin updated SQOOP-3061:

Attachment: SQOOP-3061.patch

Added patch to take care of the use case and added test cases to validate the 
change.

As part of the change, Sqoop will also reject any queries that do not have 
matched quotes, which are not detected before, like below:

SELECT * FROM test WHERE a = 'b"

Existing test cases all passed without issues.

> Sqoop --options-file failed with error "Malformed option in options file" 
> even though the query is correct
> --
>
> Key: SQOOP-3061
> URL: https://issues.apache.org/jira/browse/SQOOP-3061
> Project: Sqoop
>  Issue Type: Bug
>Affects Versions: 1.4.6
>Reporter: Eric Lin
>Priority: Minor
> Attachments: SQOOP-3061.patch
>
>
> if you have the following in the options file:
> --query
> SELECT * FROM test WHERE a = 'b'
> it will fail with the following error:
> {code}
> 16/11/22 16:08:59 ERROR sqoop.Sqoop: Error while expanding arguments
> java.lang.Exception: Malformed option in options 
> file(/tmp/sqoop_runner_from_stdin_1112_12354__sqoop_options_file): SELECT * 
> FROM test WHERE a = 'b'
> at 
> org.apache.sqoop.util.OptionsFileUtil.removeQuoteCharactersIfNecessary(OptionsFileUtil.java:170)
> at 
> org.apache.sqoop.util.OptionsFileUtil.removeQuotesEncolosingOption(OptionsFileUtil.java:136)
> at 
> org.apache.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:90)
> at 
> com.cloudera.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:33)
> at org.apache.sqoop.Sqoop.runTool(Sqoop.java:199)
> at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
> at org.apache.sqoop.Sqoop.main(Sqoop.java:236)
> Malformed option in options 
> file(/tmp/sqoop_runner_from_stdin_1112_12354__sqoop_options_file): SELECT * 
> FROM test WHERE a = 'b'
> {code}
> This is caused by function 
> org.apache.sqoop.util.OptionsFileUtil.removeQuoteCharactersIfNecessary only 
> checks for starting and ending quotes and will fail if the query does not 
> start with a quote but ends with a quote, like the example query above.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)