Re: Review Request 60587: SQOOP-3039 - Sqoop unable to export Time data "13:14:12.1234" into Time colum in RMDBS

2018-06-02 Thread Eric Lin via Review Board


> On Sept. 24, 2017, 11:18 a.m., Sandish Kumar HN wrote:
> > src/java/org/apache/sqoop/orm/Time.java
> > Lines 18 (patched)
> > 
> >
> > no new line between licence comment and package declaration.

New line already there, but sure if I misunderstood the issue.


- Eric


---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/60587/#review186057
---


On June 2, 2018, 9:13 p.m., Eric Lin wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/60587/
> ---
> 
> (Updated June 2, 2018, 9:13 p.m.)
> 
> 
> Review request for Sqoop, Boglarka Egyed, Attila Szabo, and Szabolcs Vasas.
> 
> 
> Bugs: SQOOP-3039
> https://issues.apache.org/jira/browse/SQOOP-3039
> 
> 
> Repository: sqoop-trunk
> 
> 
> Description
> ---
> 
> To re-produce:
> 
> Set up MySQL database with following schema:
> 
> {code}
> CREATE TABLE `test` (
>   `a` time(2) DEFAULT NULL
> ) ENGINE=InnoDB DEFAULT CHARSET=latin1
> {code}
> 
> Store the following data in HDFS:
> 
> {code}
> 16:56:53.0999
> 16:56:54.1
> 16:56:53.
> 16:56:54.1230
> {code}
> 
> run Sqoop export command to copy data from HDFS into MySQL:
> 
> {code}
> qoop export --connect jdbc:mysql:///test --username root 
> --password password --table test  -m 1 --driver com.mysql.jdbc.Driver  
> --export-dir /tmp/test
> {code}
> 
> Command will fail with the following error:
> 
> {code}
> java.lang.RuntimeException: Can't parse input data: '16:56:53.0999'
> at t5.__loadFromFields(t5.java:223)
> at t5.parse(t5.java:166)
> at 
> org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:89)
> at 
> org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:39)
> at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145)
> at 
> org.apache.sqoop.mapreduce.AutoProgressMapper.run(AutoProgressMapper.java:64)
> at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:784)
> at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
> at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:163)
> at java.security.AccessController.doPrivileged(Native Method)
> at javax.security.auth.Subject.doAs(Subject.java:422)
> at 
> org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628)
> at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
> Caused by: java.lang.NumberFormatException: For input string: "53.0999"
> at 
> java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
> at java.lang.Integer.parseInt(Integer.java:580)
> at java.lang.Integer.parseInt(Integer.java:615)
> at java.sql.Time.valueOf(Time.java:108)
> at t5.__loadFromFields(t5.java:215)
> ... 12 more
> {code}
> 
> Looks like Sqoop uses java.sql.Time.valueOf function to convert 
> "16:56:53.0999" to Time object, however, this function only accepts Time in 
> "hh:mm:ss" format:
> 
> https://docs.oracle.com/javase/7/docs/api/java/sql/Time.html#valueOf(java.lang.String)
> 
> 
> Diffs
> -
> 
>   src/java/org/apache/sqoop/lib/JdbcWritableBridge.java d9628dcc 
>   src/java/org/apache/sqoop/manager/ConnManager.java c80dd5d9 
>   src/java/org/apache/sqoop/orm/ClassWriter.java a4a768af 
>   src/java/org/apache/sqoop/orm/Time.java PRE-CREATION 
>   src/test/org/apache/sqoop/TestExport.java f32f620f 
>   src/test/org/apache/sqoop/orm/TestTime.java PRE-CREATION 
> 
> 
> Diff: https://reviews.apache.org/r/60587/diff/3/
> 
> 
> Testing
> ---
> 
> Test cases + manual tests
> 
> 
> Thanks,
> 
> Eric Lin
> 
>



[jira] [Commented] (SQOOP-3039) Sqoop unable to export Time data "13:14:12.1234" into Time colum in RMDBS

2018-06-02 Thread Eric Lin (JIRA)


[ 
https://issues.apache.org/jira/browse/SQOOP-3039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16499189#comment-16499189
 ] 

Eric Lin commented on SQOOP-3039:
-

Update based on latest review feedback: https://reviews.apache.org/r/60587/ 
(SQOOP-3039.3.patch)

> Sqoop unable to export Time data "13:14:12.1234" into Time colum in RMDBS
> -
>
> Key: SQOOP-3039
> URL: https://issues.apache.org/jira/browse/SQOOP-3039
> Project: Sqoop
>  Issue Type: Bug
>  Components: tools
>Affects Versions: 1.4.6, 1.4.7
>Reporter: Eric Lin
>Assignee: Eric Lin
>Priority: Minor
> Attachments: SQOOP-3039.2.patch, SQOOP-3039.3.patch, 
> SQOOP-3039.3.patch, SQOOP-3039.patch
>
>
> To re-produce:
> Set up MySQL database with following schema:
> {code}
> CREATE TABLE `test` (
>   `a` time(2) DEFAULT NULL
> ) ENGINE=InnoDB DEFAULT CHARSET=latin1
> {code}
> Store the following data in HDFS:
> {code}
> 16:56:53.0999
> 16:56:54.1
> 16:56:53.
> 16:56:54.1230
> {code}
> run Sqoop export command to copy data from HDFS into MySQL:
> {code}
> qoop export --connect jdbc:mysql:///test --username root 
> --password password --table test  -m 1 --driver com.mysql.jdbc.Driver  
> --export-dir /tmp/test
> {code}
> Command will fail with the following error:
> {code}
> java.lang.RuntimeException: Can't parse input data: '16:56:53.0999'
> at t5.__loadFromFields(t5.java:223)
> at t5.parse(t5.java:166)
> at 
> org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:89)
> at 
> org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:39)
> at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145)
> at 
> org.apache.sqoop.mapreduce.AutoProgressMapper.run(AutoProgressMapper.java:64)
> at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:784)
> at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
> at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:163)
> at java.security.AccessController.doPrivileged(Native Method)
> at javax.security.auth.Subject.doAs(Subject.java:422)
> at 
> org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628)
> at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
> Caused by: java.lang.NumberFormatException: For input string: "53.0999"
> at 
> java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
> at java.lang.Integer.parseInt(Integer.java:580)
> at java.lang.Integer.parseInt(Integer.java:615)
> at java.sql.Time.valueOf(Time.java:108)
> at t5.__loadFromFields(t5.java:215)
> ... 12 more
> {code}
> Looks like Sqoop uses java.sql.Time.valueOf function to convert 
> "16:56:53.0999" to Time object, however, this function only accepts Time in 
> "hh:mm:ss" format:
> https://docs.oracle.com/javase/7/docs/api/java/sql/Time.html#valueOf(java.lang.String)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Updated] (SQOOP-3039) Sqoop unable to export Time data "13:14:12.1234" into Time colum in RMDBS

2018-06-02 Thread Eric Lin (JIRA)


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

Eric Lin updated SQOOP-3039:

Affects Version/s: 1.4.7

> Sqoop unable to export Time data "13:14:12.1234" into Time colum in RMDBS
> -
>
> Key: SQOOP-3039
> URL: https://issues.apache.org/jira/browse/SQOOP-3039
> Project: Sqoop
>  Issue Type: Bug
>  Components: tools
>Affects Versions: 1.4.6, 1.4.7
>Reporter: Eric Lin
>Assignee: Eric Lin
>Priority: Minor
> Attachments: SQOOP-3039.2.patch, SQOOP-3039.3.patch, 
> SQOOP-3039.3.patch, SQOOP-3039.patch
>
>
> To re-produce:
> Set up MySQL database with following schema:
> {code}
> CREATE TABLE `test` (
>   `a` time(2) DEFAULT NULL
> ) ENGINE=InnoDB DEFAULT CHARSET=latin1
> {code}
> Store the following data in HDFS:
> {code}
> 16:56:53.0999
> 16:56:54.1
> 16:56:53.
> 16:56:54.1230
> {code}
> run Sqoop export command to copy data from HDFS into MySQL:
> {code}
> qoop export --connect jdbc:mysql:///test --username root 
> --password password --table test  -m 1 --driver com.mysql.jdbc.Driver  
> --export-dir /tmp/test
> {code}
> Command will fail with the following error:
> {code}
> java.lang.RuntimeException: Can't parse input data: '16:56:53.0999'
> at t5.__loadFromFields(t5.java:223)
> at t5.parse(t5.java:166)
> at 
> org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:89)
> at 
> org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:39)
> at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145)
> at 
> org.apache.sqoop.mapreduce.AutoProgressMapper.run(AutoProgressMapper.java:64)
> at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:784)
> at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
> at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:163)
> at java.security.AccessController.doPrivileged(Native Method)
> at javax.security.auth.Subject.doAs(Subject.java:422)
> at 
> org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628)
> at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
> Caused by: java.lang.NumberFormatException: For input string: "53.0999"
> at 
> java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
> at java.lang.Integer.parseInt(Integer.java:580)
> at java.lang.Integer.parseInt(Integer.java:615)
> at java.sql.Time.valueOf(Time.java:108)
> at t5.__loadFromFields(t5.java:215)
> ... 12 more
> {code}
> Looks like Sqoop uses java.sql.Time.valueOf function to convert 
> "16:56:53.0999" to Time object, however, this function only accepts Time in 
> "hh:mm:ss" format:
> https://docs.oracle.com/javase/7/docs/api/java/sql/Time.html#valueOf(java.lang.String)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Updated] (SQOOP-3039) Sqoop unable to export Time data "13:14:12.1234" into Time colum in RMDBS

2018-06-02 Thread Eric Lin (JIRA)


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

Eric Lin updated SQOOP-3039:

Attachment: SQOOP-3039.3.patch

> Sqoop unable to export Time data "13:14:12.1234" into Time colum in RMDBS
> -
>
> Key: SQOOP-3039
> URL: https://issues.apache.org/jira/browse/SQOOP-3039
> Project: Sqoop
>  Issue Type: Bug
>  Components: tools
>Affects Versions: 1.4.6
>Reporter: Eric Lin
>Assignee: Eric Lin
>Priority: Minor
> Attachments: SQOOP-3039.2.patch, SQOOP-3039.3.patch, 
> SQOOP-3039.3.patch, SQOOP-3039.patch
>
>
> To re-produce:
> Set up MySQL database with following schema:
> {code}
> CREATE TABLE `test` (
>   `a` time(2) DEFAULT NULL
> ) ENGINE=InnoDB DEFAULT CHARSET=latin1
> {code}
> Store the following data in HDFS:
> {code}
> 16:56:53.0999
> 16:56:54.1
> 16:56:53.
> 16:56:54.1230
> {code}
> run Sqoop export command to copy data from HDFS into MySQL:
> {code}
> qoop export --connect jdbc:mysql:///test --username root 
> --password password --table test  -m 1 --driver com.mysql.jdbc.Driver  
> --export-dir /tmp/test
> {code}
> Command will fail with the following error:
> {code}
> java.lang.RuntimeException: Can't parse input data: '16:56:53.0999'
> at t5.__loadFromFields(t5.java:223)
> at t5.parse(t5.java:166)
> at 
> org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:89)
> at 
> org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:39)
> at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145)
> at 
> org.apache.sqoop.mapreduce.AutoProgressMapper.run(AutoProgressMapper.java:64)
> at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:784)
> at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
> at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:163)
> at java.security.AccessController.doPrivileged(Native Method)
> at javax.security.auth.Subject.doAs(Subject.java:422)
> at 
> org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628)
> at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
> Caused by: java.lang.NumberFormatException: For input string: "53.0999"
> at 
> java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
> at java.lang.Integer.parseInt(Integer.java:580)
> at java.lang.Integer.parseInt(Integer.java:615)
> at java.sql.Time.valueOf(Time.java:108)
> at t5.__loadFromFields(t5.java:215)
> ... 12 more
> {code}
> Looks like Sqoop uses java.sql.Time.valueOf function to convert 
> "16:56:53.0999" to Time object, however, this function only accepts Time in 
> "hh:mm:ss" format:
> https://docs.oracle.com/javase/7/docs/api/java/sql/Time.html#valueOf(java.lang.String)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


Re: Review Request 60587: SQOOP-3039 - Sqoop unable to export Time data "13:14:12.1234" into Time colum in RMDBS

2018-06-02 Thread Eric Lin via Review Board

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/60587/
---

(Updated June 2, 2018, 9:11 p.m.)


Review request for Sqoop, Attila Szabo and Szabolcs Vasas.


Changes
---

Updates based on review feedback, sorry about the delay!!


Bugs: SQOOP-3039
https://issues.apache.org/jira/browse/SQOOP-3039


Repository: sqoop-trunk


Description
---

To re-produce:

Set up MySQL database with following schema:

{code}
CREATE TABLE `test` (
  `a` time(2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
{code}

Store the following data in HDFS:

{code}
16:56:53.0999
16:56:54.1
16:56:53.
16:56:54.1230
{code}

run Sqoop export command to copy data from HDFS into MySQL:

{code}
qoop export --connect jdbc:mysql:///test --username root --password 
password --table test  -m 1 --driver com.mysql.jdbc.Driver  --export-dir 
/tmp/test
{code}

Command will fail with the following error:

{code}
java.lang.RuntimeException: Can't parse input data: '16:56:53.0999'
at t5.__loadFromFields(t5.java:223)
at t5.parse(t5.java:166)
at 
org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:89)
at 
org.apache.sqoop.mapreduce.TextExportMapper.map(TextExportMapper.java:39)
at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145)
at 
org.apache.sqoop.mapreduce.AutoProgressMapper.run(AutoProgressMapper.java:64)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:784)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:163)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at 
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628)
at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
Caused by: java.lang.NumberFormatException: For input string: "53.0999"
at 
java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.parseInt(Integer.java:615)
at java.sql.Time.valueOf(Time.java:108)
at t5.__loadFromFields(t5.java:215)
... 12 more
{code}

Looks like Sqoop uses java.sql.Time.valueOf function to convert "16:56:53.0999" 
to Time object, however, this function only accepts Time in "hh:mm:ss" format:

https://docs.oracle.com/javase/7/docs/api/java/sql/Time.html#valueOf(java.lang.String)


Diffs (updated)
-

  src/java/org/apache/sqoop/lib/JdbcWritableBridge.java d9628dcc 
  src/java/org/apache/sqoop/manager/ConnManager.java c80dd5d9 
  src/java/org/apache/sqoop/orm/ClassWriter.java a4a768af 
  src/java/org/apache/sqoop/orm/Time.java PRE-CREATION 
  src/test/org/apache/sqoop/TestExport.java f32f620f 
  src/test/org/apache/sqoop/orm/TestTime.java PRE-CREATION 


Diff: https://reviews.apache.org/r/60587/diff/3/

Changes: https://reviews.apache.org/r/60587/diff/2-3/


Testing
---

Test cases + manual tests


Thanks,

Eric Lin



[jira] [Commented] (SQOOP-3330) Sqoop --append does not work with -Dmapreduce.output.basename

2018-06-02 Thread Eric Lin (JIRA)


[ 
https://issues.apache.org/jira/browse/SQOOP-3330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16498908#comment-16498908
 ] 

Eric Lin commented on SQOOP-3330:
-

First version of patch uploaded, review request at: 
https://reviews.apache.org/r/67424/

> Sqoop --append does not work with -Dmapreduce.output.basename
> -
>
> Key: SQOOP-3330
> URL: https://issues.apache.org/jira/browse/SQOOP-3330
> Project: Sqoop
>  Issue Type: Bug
>  Components: tools
>Affects Versions: 1.4.7
>Reporter: Eric Lin
>Assignee: Eric Lin
>Priority: Major
> Attachments: SQOOP-3330-1.patch
>
>
> When adding --append to Sqoop directory import with 
> -Dmapreduce.output.basename, all files will be ignored, which end up nothing 
> being imported. See below DEBUG output:
> {code}
> sqoop import -Dmapreduce.output.basename="eric-test" --connect 
> jdbc:mysql://mysql-host.com/test --username root --password 'root' --table 
> test --target-dir /tmp/ericlin-test/sqoop/test --fields-terminated-by '\t' 
> --verbose --append
> 18/05/28 22:24:44 INFO util.AppendUtils: Appending to directory test
> 18/05/28 22:24:44 DEBUG util.AppendUtils: Filename: _SUCCESS ignored
> 18/05/28 22:24:44 DEBUG util.AppendUtils: Filename: eric-test-m-0 ignored
> 18/05/28 22:24:44 DEBUG util.AppendUtils: Filename: eric-test-m-1 ignored
> 18/05/28 22:24:44 DEBUG util.AppendUtils: Filename: eric-test-m-2 ignored
> 18/05/28 22:24:44 DEBUG util.AppendUtils: Deleting temporary folder 
> 14935e396acc4ea7b9a6236c66064c9b_test
> {code}
> This is due to AppendUtils only recognizes file name starts with 
> "part.*-([0-9]"
> https://github.com/apache/sqoop/blob/branch-1.4.7/src/java/org/apache/sqoop/util/AppendUtils.java#L46



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


Review Request 67424: SQOOP-3330 - Sqoop --append does not work with -Dmapreduce.output.basename

2018-06-02 Thread Eric Lin via Review Board

---
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/67424/
---

Review request for Sqoop.


Bugs: SQOOP-3330
https://issues.apache.org/jira/browse/SQOOP-3330


Repository: sqoop-trunk


Description
---

When adding --append to Sqoop directory import with 
-Dmapreduce.output.basename, all files will be ignored, which end up nothing 
being imported. See below DEBUG output:

{code}
sqoop import -Dmapreduce.output.basename="eric-test" --connect 
jdbc:mysql://mysql-host.com/test --username root --password 'root' --table test 
--target-dir /tmp/ericlin-test/sqoop/test --fields-terminated-by '\t' --verbose 
--append

18/05/28 22:24:44 INFO util.AppendUtils: Appending to directory test
18/05/28 22:24:44 DEBUG util.AppendUtils: Filename: _SUCCESS ignored
18/05/28 22:24:44 DEBUG util.AppendUtils: Filename: eric-test-m-0 ignored
18/05/28 22:24:44 DEBUG util.AppendUtils: Filename: eric-test-m-1 ignored
18/05/28 22:24:44 DEBUG util.AppendUtils: Filename: eric-test-m-2 ignored
18/05/28 22:24:44 DEBUG util.AppendUtils: Deleting temporary folder 
14935e396acc4ea7b9a6236c66064c9b_test
{code}

This is due to AppendUtils only recognizes file name starts with "part.*-([0-9]"

https://github.com/apache/sqoop/blob/branch-1.4.7/src/java/org/apache/sqoop/util/AppendUtils.java#L46


Diffs
-

  .gitignore 68cbe287 
  src/java/org/apache/sqoop/util/AppendUtils.java fa852804 
  src/test/org/apache/sqoop/TestAppendUtils.java f14fc6ad 


Diff: https://reviews.apache.org/r/67424/diff/1/


Testing
---

Added test case + manual test in VM


Thanks,

Eric Lin