You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sqoop.apache.org by "Tom White (JIRA)" <ji...@apache.org> on 2011/09/23 20:04:26 UTC

[jira] [Created] (SQOOP-352) Export of avro data imported from database table (using sqoop import) fails on year

Export of avro data imported from database table (using sqoop import) fails on year
-----------------------------------------------------------------------------------

                 Key: SQOOP-352
                 URL: https://issues.apache.org/jira/browse/SQOOP-352
             Project: Sqoop
          Issue Type: Bug
          Components: connectors/mysql
            Reporter: Tom White


Report from Wing Yew Poon:

I use a MySQL database for testing sqoop. I created a table with a representative collection of data types for the columns, excluding blob and text (and their different-sized variants).
I run sqoop import --as-avrodatafile to import the table into hdfs.
I create a second table with the same schema, and run sqoop export to export the avro data to this second table. The export fails with

{noformat}
java.io.IOException: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
	at com.cloudera.sqoop.mapreduce.AsyncSqlRecordWriter.close(AsyncSqlRecordWriter.java:180)
	at org.apache.hadoop.mapred.MapTask$NewDirectOutputCollector.close(MapTask.java:540)
	at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:649)
	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
	at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:396)
	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1127)
	at org.apache.hadoop.mapred.Child.main(Child.java:264)
Caused by: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077)
	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1356)
	at com.cloudera.sqoop.mapreduce.AsyncSqlOutputFormat$AsyncSqlExecThread.run(AsyncSqlOutputFormat.java:232)
{noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SQOOP-352) Export of avro data imported from database table (using sqoop import) fails on year

Posted by "jiraposter@reviews.apache.org (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SQOOP-352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13219814#comment-13219814 ] 

jiraposter@reviews.apache.org commented on SQOOP-352:
-----------------------------------------------------


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

(Updated 2012-03-01 05:17:15.849853)


Review request for Sqoop, Arvind Prabhakar, Tom White, and Jarek Cecho.


Summary
-------

MySQL YEAR is mapped to java.sql.Date when importing to HDFS. On the way back an exception is thrown because the date and month fields are truncated (not used) - this is the MySQL behaviour.


This addresses bug SQOOP-352.
    https://issues.apache.org/jira/browse/SQOOP-352


Diffs
-----

  ./src/java/org/apache/sqoop/hive/TableDefWriter.java 1293040 
  ./src/java/org/apache/sqoop/manager/ConnManager.java 1293040 
  ./src/java/org/apache/sqoop/manager/MySQLManager.java 1293040 
  ./src/java/org/apache/sqoop/manager/OracleManager.java 1293040 
  ./src/java/org/apache/sqoop/manager/SqlManager.java 1293040 
  ./src/java/org/apache/sqoop/mapreduce/JdbcExportJob.java 1293040 
  ./src/java/org/apache/sqoop/orm/AvroSchemaGenerator.java 1293040 
  ./src/java/org/apache/sqoop/orm/ClassWriter.java 1293040 
  ./src/test/com/cloudera/sqoop/TestConnFactory.java 1293040 
  ./src/test/com/cloudera/sqoop/manager/MySQLCompatTest.java 1293040 

Diff: https://reviews.apache.org/r/3845/diff


Testing
-------


Thanks,

Bilung


                
> Export of avro data imported from database table (using sqoop import) fails on year
> -----------------------------------------------------------------------------------
>
>                 Key: SQOOP-352
>                 URL: https://issues.apache.org/jira/browse/SQOOP-352
>             Project: Sqoop
>          Issue Type: Bug
>          Components: connectors/mysql
>            Reporter: Tom White
>            Assignee: Bilung Lee
>
> Report from Wing Yew Poon:
> I use a MySQL database for testing sqoop. I created a table with a representative collection of data types for the columns, excluding blob and text (and their different-sized variants).
> I run sqoop import --as-avrodatafile to import the table into hdfs.
> I create a second table with the same schema, and run sqoop export to export the avro data to this second table. The export fails with
> {noformat}
> java.io.IOException: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
> 	at com.cloudera.sqoop.mapreduce.AsyncSqlRecordWriter.close(AsyncSqlRecordWriter.java:180)
> 	at org.apache.hadoop.mapred.MapTask$NewDirectOutputCollector.close(MapTask.java:540)
> 	at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:649)
> 	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
> 	at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at javax.security.auth.Subject.doAs(Subject.java:396)
> 	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1127)
> 	at org.apache.hadoop.mapred.Child.main(Child.java:264)
> Caused by: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
> 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
> 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
> 	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
> 	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
> 	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
> 	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077)
> 	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1356)
> 	at com.cloudera.sqoop.mapreduce.AsyncSqlOutputFormat$AsyncSqlExecThread.run(AsyncSqlOutputFormat.java:232)
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (SQOOP-352) Export of avro data imported from database table (using sqoop import) fails on year

Posted by "Arvind Prabhakar (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SQOOP-352?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arvind Prabhakar updated SQOOP-352:
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.4.2-incubating
           Status: Resolved  (was: Patch Available)

Patch committed. Thanks Bilung!
                
> Export of avro data imported from database table (using sqoop import) fails on year
> -----------------------------------------------------------------------------------
>
>                 Key: SQOOP-352
>                 URL: https://issues.apache.org/jira/browse/SQOOP-352
>             Project: Sqoop
>          Issue Type: Bug
>          Components: connectors/mysql
>            Reporter: Tom White
>            Assignee: Bilung Lee
>             Fix For: 1.4.2-incubating
>
>         Attachments: SQOOP-352.patch
>
>
> Report from Wing Yew Poon:
> I use a MySQL database for testing sqoop. I created a table with a representative collection of data types for the columns, excluding blob and text (and their different-sized variants).
> I run sqoop import --as-avrodatafile to import the table into hdfs.
> I create a second table with the same schema, and run sqoop export to export the avro data to this second table. The export fails with
> {noformat}
> java.io.IOException: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
> 	at com.cloudera.sqoop.mapreduce.AsyncSqlRecordWriter.close(AsyncSqlRecordWriter.java:180)
> 	at org.apache.hadoop.mapred.MapTask$NewDirectOutputCollector.close(MapTask.java:540)
> 	at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:649)
> 	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
> 	at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at javax.security.auth.Subject.doAs(Subject.java:396)
> 	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1127)
> 	at org.apache.hadoop.mapred.Child.main(Child.java:264)
> Caused by: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
> 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
> 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
> 	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
> 	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
> 	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
> 	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077)
> 	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1356)
> 	at com.cloudera.sqoop.mapreduce.AsyncSqlOutputFormat$AsyncSqlExecThread.run(AsyncSqlOutputFormat.java:232)
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SQOOP-352) Export of avro data imported from database table (using sqoop import) fails on year

Posted by "jiraposter@reviews.apache.org (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SQOOP-352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13218756#comment-13218756 ] 

jiraposter@reviews.apache.org commented on SQOOP-352:
-----------------------------------------------------


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

Review request for Sqoop, Tom White and Jarek Cecho.


Summary
-------

MySQL YEAR is mapped to java.sql.Date when importing to HDFS. On the way back an exception is thrown because the date and month fields are truncated (not used) - this is the MySQL behaviour.


This addresses bug SQOOP-352.
    https://issues.apache.org/jira/browse/SQOOP-352


Diffs
-----

  ./src/java/org/apache/sqoop/hive/TableDefWriter.java 1293040 
  ./src/java/org/apache/sqoop/manager/ConnManager.java 1293040 
  ./src/java/org/apache/sqoop/manager/MySQLManager.java 1293040 
  ./src/java/org/apache/sqoop/manager/OracleManager.java 1293040 
  ./src/java/org/apache/sqoop/manager/SqlManager.java 1293040 
  ./src/java/org/apache/sqoop/mapreduce/JdbcExportJob.java 1293040 
  ./src/java/org/apache/sqoop/orm/AvroSchemaGenerator.java 1293040 
  ./src/java/org/apache/sqoop/orm/ClassWriter.java 1293040 
  ./src/test/com/cloudera/sqoop/TestConnFactory.java 1293040 
  ./src/test/com/cloudera/sqoop/manager/MySQLCompatTest.java 1293040 

Diff: https://reviews.apache.org/r/3845/diff


Testing
-------


Thanks,

Bilung


                
> Export of avro data imported from database table (using sqoop import) fails on year
> -----------------------------------------------------------------------------------
>
>                 Key: SQOOP-352
>                 URL: https://issues.apache.org/jira/browse/SQOOP-352
>             Project: Sqoop
>          Issue Type: Bug
>          Components: connectors/mysql
>            Reporter: Tom White
>            Assignee: Bilung Lee
>
> Report from Wing Yew Poon:
> I use a MySQL database for testing sqoop. I created a table with a representative collection of data types for the columns, excluding blob and text (and their different-sized variants).
> I run sqoop import --as-avrodatafile to import the table into hdfs.
> I create a second table with the same schema, and run sqoop export to export the avro data to this second table. The export fails with
> {noformat}
> java.io.IOException: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
> 	at com.cloudera.sqoop.mapreduce.AsyncSqlRecordWriter.close(AsyncSqlRecordWriter.java:180)
> 	at org.apache.hadoop.mapred.MapTask$NewDirectOutputCollector.close(MapTask.java:540)
> 	at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:649)
> 	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
> 	at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at javax.security.auth.Subject.doAs(Subject.java:396)
> 	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1127)
> 	at org.apache.hadoop.mapred.Child.main(Child.java:264)
> Caused by: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
> 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
> 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
> 	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
> 	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
> 	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
> 	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077)
> 	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1356)
> 	at com.cloudera.sqoop.mapreduce.AsyncSqlOutputFormat$AsyncSqlExecThread.run(AsyncSqlOutputFormat.java:232)
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SQOOP-352) Export of avro data imported from database table (using sqoop import) fails on year

Posted by "Tom White (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SQOOP-352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13113622#comment-13113622 ] 

Tom White commented on SQOOP-352:
---------------------------------

MySQL YEAR is mapped to java.sql.Date when importing to HDFS. On the way back an exception is thrown because the date and month fields are truncated (not used) - this is the MySQL behaviour (see e.g. http://comments.gmane.org/gmane.comp.db.mysql.java/5187).

It's possible to get the MySQL JDBC connector to represent a YEAR as a short by setting yearIsDateType to false, by setting the property in the JDBC URL: http://dev.mysql.md/doc/refman/5.0/en/connector-j-reference-configuration-properties.html. I haven't tried this.

Another workaround is to declare the field as DATE (at least in the table being exported into).

> Export of avro data imported from database table (using sqoop import) fails on year
> -----------------------------------------------------------------------------------
>
>                 Key: SQOOP-352
>                 URL: https://issues.apache.org/jira/browse/SQOOP-352
>             Project: Sqoop
>          Issue Type: Bug
>          Components: connectors/mysql
>            Reporter: Tom White
>
> Report from Wing Yew Poon:
> I use a MySQL database for testing sqoop. I created a table with a representative collection of data types for the columns, excluding blob and text (and their different-sized variants).
> I run sqoop import --as-avrodatafile to import the table into hdfs.
> I create a second table with the same schema, and run sqoop export to export the avro data to this second table. The export fails with
> {noformat}
> java.io.IOException: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
> 	at com.cloudera.sqoop.mapreduce.AsyncSqlRecordWriter.close(AsyncSqlRecordWriter.java:180)
> 	at org.apache.hadoop.mapred.MapTask$NewDirectOutputCollector.close(MapTask.java:540)
> 	at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:649)
> 	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
> 	at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at javax.security.auth.Subject.doAs(Subject.java:396)
> 	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1127)
> 	at org.apache.hadoop.mapred.Child.main(Child.java:264)
> Caused by: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
> 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
> 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
> 	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
> 	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
> 	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
> 	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077)
> 	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1356)
> 	at com.cloudera.sqoop.mapreduce.AsyncSqlOutputFormat$AsyncSqlExecThread.run(AsyncSqlOutputFormat.java:232)
> {noformat}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (SQOOP-352) Export of avro data imported from database table (using sqoop import) fails on year

Posted by "Bilung Lee (Assigned) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SQOOP-352?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bilung Lee reassigned SQOOP-352:
--------------------------------

    Assignee: Bilung Lee
    
> Export of avro data imported from database table (using sqoop import) fails on year
> -----------------------------------------------------------------------------------
>
>                 Key: SQOOP-352
>                 URL: https://issues.apache.org/jira/browse/SQOOP-352
>             Project: Sqoop
>          Issue Type: Bug
>          Components: connectors/mysql
>            Reporter: Tom White
>            Assignee: Bilung Lee
>
> Report from Wing Yew Poon:
> I use a MySQL database for testing sqoop. I created a table with a representative collection of data types for the columns, excluding blob and text (and their different-sized variants).
> I run sqoop import --as-avrodatafile to import the table into hdfs.
> I create a second table with the same schema, and run sqoop export to export the avro data to this second table. The export fails with
> {noformat}
> java.io.IOException: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
> 	at com.cloudera.sqoop.mapreduce.AsyncSqlRecordWriter.close(AsyncSqlRecordWriter.java:180)
> 	at org.apache.hadoop.mapred.MapTask$NewDirectOutputCollector.close(MapTask.java:540)
> 	at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:649)
> 	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
> 	at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at javax.security.auth.Subject.doAs(Subject.java:396)
> 	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1127)
> 	at org.apache.hadoop.mapred.Child.main(Child.java:264)
> Caused by: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
> 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
> 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
> 	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
> 	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
> 	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
> 	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077)
> 	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1356)
> 	at com.cloudera.sqoop.mapreduce.AsyncSqlOutputFormat$AsyncSqlExecThread.run(AsyncSqlOutputFormat.java:232)
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SQOOP-352) Export of avro data imported from database table (using sqoop import) fails on year

Posted by "jiraposter@reviews.apache.org (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SQOOP-352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13221329#comment-13221329 ] 

jiraposter@reviews.apache.org commented on SQOOP-352:
-----------------------------------------------------


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

(Updated 2012-03-02 22:48:24.704210)


Review request for Sqoop, Arvind Prabhakar, Tom White, and Jarek Cecho.


Changes
-------

Thanks for your comments, Arvind!

New patch is attached.


Summary
-------

MySQL YEAR is mapped to java.sql.Date when importing to HDFS. On the way back an exception is thrown because the date and month fields are truncated (not used) - this is the MySQL behaviour.


This addresses bug SQOOP-352.
    https://issues.apache.org/jira/browse/SQOOP-352


Diffs (updated)
-----

  ./src/java/org/apache/sqoop/hive/TableDefWriter.java 1296490 
  ./src/java/org/apache/sqoop/manager/ConnManager.java 1296490 
  ./src/java/org/apache/sqoop/manager/MySQLManager.java 1296490 
  ./src/java/org/apache/sqoop/manager/OracleManager.java 1296490 
  ./src/java/org/apache/sqoop/manager/SqlManager.java 1296490 
  ./src/java/org/apache/sqoop/mapreduce/JdbcExportJob.java 1296490 
  ./src/java/org/apache/sqoop/orm/AvroSchemaGenerator.java 1296490 
  ./src/java/org/apache/sqoop/orm/ClassWriter.java 1296490 
  ./src/test/com/cloudera/sqoop/manager/MySQLCompatTest.java 1296490 

Diff: https://reviews.apache.org/r/3845/diff


Testing
-------


Thanks,

Bilung


                
> Export of avro data imported from database table (using sqoop import) fails on year
> -----------------------------------------------------------------------------------
>
>                 Key: SQOOP-352
>                 URL: https://issues.apache.org/jira/browse/SQOOP-352
>             Project: Sqoop
>          Issue Type: Bug
>          Components: connectors/mysql
>            Reporter: Tom White
>            Assignee: Bilung Lee
>
> Report from Wing Yew Poon:
> I use a MySQL database for testing sqoop. I created a table with a representative collection of data types for the columns, excluding blob and text (and their different-sized variants).
> I run sqoop import --as-avrodatafile to import the table into hdfs.
> I create a second table with the same schema, and run sqoop export to export the avro data to this second table. The export fails with
> {noformat}
> java.io.IOException: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
> 	at com.cloudera.sqoop.mapreduce.AsyncSqlRecordWriter.close(AsyncSqlRecordWriter.java:180)
> 	at org.apache.hadoop.mapred.MapTask$NewDirectOutputCollector.close(MapTask.java:540)
> 	at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:649)
> 	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
> 	at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at javax.security.auth.Subject.doAs(Subject.java:396)
> 	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1127)
> 	at org.apache.hadoop.mapred.Child.main(Child.java:264)
> Caused by: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
> 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
> 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
> 	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
> 	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
> 	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
> 	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077)
> 	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1356)
> 	at com.cloudera.sqoop.mapreduce.AsyncSqlOutputFormat$AsyncSqlExecThread.run(AsyncSqlOutputFormat.java:232)
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (SQOOP-352) Export of avro data imported from database table (using sqoop import) fails on year

Posted by "Bilung Lee (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SQOOP-352?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bilung Lee updated SQOOP-352:
-----------------------------

    Status: Patch Available  (was: Open)
    
> Export of avro data imported from database table (using sqoop import) fails on year
> -----------------------------------------------------------------------------------
>
>                 Key: SQOOP-352
>                 URL: https://issues.apache.org/jira/browse/SQOOP-352
>             Project: Sqoop
>          Issue Type: Bug
>          Components: connectors/mysql
>            Reporter: Tom White
>            Assignee: Bilung Lee
>
> Report from Wing Yew Poon:
> I use a MySQL database for testing sqoop. I created a table with a representative collection of data types for the columns, excluding blob and text (and their different-sized variants).
> I run sqoop import --as-avrodatafile to import the table into hdfs.
> I create a second table with the same schema, and run sqoop export to export the avro data to this second table. The export fails with
> {noformat}
> java.io.IOException: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
> 	at com.cloudera.sqoop.mapreduce.AsyncSqlRecordWriter.close(AsyncSqlRecordWriter.java:180)
> 	at org.apache.hadoop.mapred.MapTask$NewDirectOutputCollector.close(MapTask.java:540)
> 	at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:649)
> 	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
> 	at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at javax.security.auth.Subject.doAs(Subject.java:396)
> 	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1127)
> 	at org.apache.hadoop.mapred.Child.main(Child.java:264)
> Caused by: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
> 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
> 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
> 	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
> 	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
> 	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
> 	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077)
> 	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1356)
> 	at com.cloudera.sqoop.mapreduce.AsyncSqlOutputFormat$AsyncSqlExecThread.run(AsyncSqlOutputFormat.java:232)
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (SQOOP-352) Export of avro data imported from database table (using sqoop import) fails on year

Posted by "Bilung Lee (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SQOOP-352?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bilung Lee updated SQOOP-352:
-----------------------------

    Attachment: SQOOP-352.patch
    
> Export of avro data imported from database table (using sqoop import) fails on year
> -----------------------------------------------------------------------------------
>
>                 Key: SQOOP-352
>                 URL: https://issues.apache.org/jira/browse/SQOOP-352
>             Project: Sqoop
>          Issue Type: Bug
>          Components: connectors/mysql
>            Reporter: Tom White
>            Assignee: Bilung Lee
>         Attachments: SQOOP-352.patch
>
>
> Report from Wing Yew Poon:
> I use a MySQL database for testing sqoop. I created a table with a representative collection of data types for the columns, excluding blob and text (and their different-sized variants).
> I run sqoop import --as-avrodatafile to import the table into hdfs.
> I create a second table with the same schema, and run sqoop export to export the avro data to this second table. The export fails with
> {noformat}
> java.io.IOException: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
> 	at com.cloudera.sqoop.mapreduce.AsyncSqlRecordWriter.close(AsyncSqlRecordWriter.java:180)
> 	at org.apache.hadoop.mapred.MapTask$NewDirectOutputCollector.close(MapTask.java:540)
> 	at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:649)
> 	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
> 	at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at javax.security.auth.Subject.doAs(Subject.java:396)
> 	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1127)
> 	at org.apache.hadoop.mapred.Child.main(Child.java:264)
> Caused by: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
> 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
> 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
> 	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
> 	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
> 	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
> 	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077)
> 	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1356)
> 	at com.cloudera.sqoop.mapreduce.AsyncSqlOutputFormat$AsyncSqlExecThread.run(AsyncSqlOutputFormat.java:232)
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SQOOP-352) Export of avro data imported from database table (using sqoop import) fails on year

Posted by "Hudson (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SQOOP-352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13223780#comment-13223780 ] 

Hudson commented on SQOOP-352:
------------------------------

Integrated in Sqoop-ant-jdk-1.6 #94 (See [https://builds.apache.org/job/Sqoop-ant-jdk-1.6/94/])
    SQOOP-352. Export of avro data fails on year values.

(Bilung Lee via Arvind Prabhakar) (Revision 1297782)

     Result = SUCCESS
arvind : http://svn.apache.org/viewvc/?view=rev&rev=1297782
Files : 
* /incubator/sqoop/trunk/src/java/org/apache/sqoop/hive/TableDefWriter.java
* /incubator/sqoop/trunk/src/java/org/apache/sqoop/manager/ConnManager.java
* /incubator/sqoop/trunk/src/java/org/apache/sqoop/manager/MySQLManager.java
* /incubator/sqoop/trunk/src/java/org/apache/sqoop/manager/OracleManager.java
* /incubator/sqoop/trunk/src/java/org/apache/sqoop/manager/SqlManager.java
* /incubator/sqoop/trunk/src/java/org/apache/sqoop/mapreduce/JdbcExportJob.java
* /incubator/sqoop/trunk/src/java/org/apache/sqoop/orm/AvroSchemaGenerator.java
* /incubator/sqoop/trunk/src/java/org/apache/sqoop/orm/ClassWriter.java
* /incubator/sqoop/trunk/src/test/com/cloudera/sqoop/manager/MySQLCompatTest.java

                
> Export of avro data imported from database table (using sqoop import) fails on year
> -----------------------------------------------------------------------------------
>
>                 Key: SQOOP-352
>                 URL: https://issues.apache.org/jira/browse/SQOOP-352
>             Project: Sqoop
>          Issue Type: Bug
>          Components: connectors/mysql
>            Reporter: Tom White
>            Assignee: Bilung Lee
>             Fix For: 1.4.2-incubating
>
>         Attachments: SQOOP-352.patch
>
>
> Report from Wing Yew Poon:
> I use a MySQL database for testing sqoop. I created a table with a representative collection of data types for the columns, excluding blob and text (and their different-sized variants).
> I run sqoop import --as-avrodatafile to import the table into hdfs.
> I create a second table with the same schema, and run sqoop export to export the avro data to this second table. The export fails with
> {noformat}
> java.io.IOException: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
> 	at com.cloudera.sqoop.mapreduce.AsyncSqlRecordWriter.close(AsyncSqlRecordWriter.java:180)
> 	at org.apache.hadoop.mapred.MapTask$NewDirectOutputCollector.close(MapTask.java:540)
> 	at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:649)
> 	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
> 	at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at javax.security.auth.Subject.doAs(Subject.java:396)
> 	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1127)
> 	at org.apache.hadoop.mapred.Child.main(Child.java:264)
> Caused by: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
> 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
> 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
> 	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
> 	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
> 	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
> 	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077)
> 	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1356)
> 	at com.cloudera.sqoop.mapreduce.AsyncSqlOutputFormat$AsyncSqlExecThread.run(AsyncSqlOutputFormat.java:232)
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SQOOP-352) Export of avro data imported from database table (using sqoop import) fails on year

Posted by "jiraposter@reviews.apache.org (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SQOOP-352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13220749#comment-13220749 ] 

jiraposter@reviews.apache.org commented on SQOOP-352:
-----------------------------------------------------


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


Thanks for the patch Bilung. The logic of the change is sound but I am concerned about backward compatibility.


./src/java/org/apache/sqoop/manager/ConnManager.java
<https://reviews.apache.org/r/3845/#comment11992>

    This change along with the change to toHiveType() and introduction of toAvroType() breaks backward compatibility. 


One way to address this would be to keep the old abstract API of ConnManager and introduce new, non-abstract methods toJavaType(String columnName, int sqlType) which by default ignores the column name and returns toJavaType(sqlType). This way, you stay backwards compatible and built in connection managers can use the new functionality.

Another way that could possibly address this is by overwriting the getColumnTypesForRawQuery(String stmt) in MySQLManager and mapping the YEAR type to SMALLINT. Not sure if it will work or not, but is worth exploring.

- Arvind


On 2012-03-01 05:17:15, Bilung Lee wrote:
bq.  
bq.  -----------------------------------------------------------
bq.  This is an automatically generated e-mail. To reply, visit:
bq.  https://reviews.apache.org/r/3845/
bq.  -----------------------------------------------------------
bq.  
bq.  (Updated 2012-03-01 05:17:15)
bq.  
bq.  
bq.  Review request for Sqoop, Arvind Prabhakar, Tom White, and Jarek Cecho.
bq.  
bq.  
bq.  Summary
bq.  -------
bq.  
bq.  MySQL YEAR is mapped to java.sql.Date when importing to HDFS. On the way back an exception is thrown because the date and month fields are truncated (not used) - this is the MySQL behaviour.
bq.  
bq.  
bq.  This addresses bug SQOOP-352.
bq.      https://issues.apache.org/jira/browse/SQOOP-352
bq.  
bq.  
bq.  Diffs
bq.  -----
bq.  
bq.    ./src/java/org/apache/sqoop/hive/TableDefWriter.java 1293040 
bq.    ./src/java/org/apache/sqoop/manager/ConnManager.java 1293040 
bq.    ./src/java/org/apache/sqoop/manager/MySQLManager.java 1293040 
bq.    ./src/java/org/apache/sqoop/manager/OracleManager.java 1293040 
bq.    ./src/java/org/apache/sqoop/manager/SqlManager.java 1293040 
bq.    ./src/java/org/apache/sqoop/mapreduce/JdbcExportJob.java 1293040 
bq.    ./src/java/org/apache/sqoop/orm/AvroSchemaGenerator.java 1293040 
bq.    ./src/java/org/apache/sqoop/orm/ClassWriter.java 1293040 
bq.    ./src/test/com/cloudera/sqoop/TestConnFactory.java 1293040 
bq.    ./src/test/com/cloudera/sqoop/manager/MySQLCompatTest.java 1293040 
bq.  
bq.  Diff: https://reviews.apache.org/r/3845/diff
bq.  
bq.  
bq.  Testing
bq.  -------
bq.  
bq.  
bq.  Thanks,
bq.  
bq.  Bilung
bq.  
bq.


                
> Export of avro data imported from database table (using sqoop import) fails on year
> -----------------------------------------------------------------------------------
>
>                 Key: SQOOP-352
>                 URL: https://issues.apache.org/jira/browse/SQOOP-352
>             Project: Sqoop
>          Issue Type: Bug
>          Components: connectors/mysql
>            Reporter: Tom White
>            Assignee: Bilung Lee
>
> Report from Wing Yew Poon:
> I use a MySQL database for testing sqoop. I created a table with a representative collection of data types for the columns, excluding blob and text (and their different-sized variants).
> I run sqoop import --as-avrodatafile to import the table into hdfs.
> I create a second table with the same schema, and run sqoop export to export the avro data to this second table. The export fails with
> {noformat}
> java.io.IOException: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
> 	at com.cloudera.sqoop.mapreduce.AsyncSqlRecordWriter.close(AsyncSqlRecordWriter.java:180)
> 	at org.apache.hadoop.mapred.MapTask$NewDirectOutputCollector.close(MapTask.java:540)
> 	at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:649)
> 	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
> 	at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at javax.security.auth.Subject.doAs(Subject.java:396)
> 	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1127)
> 	at org.apache.hadoop.mapred.Child.main(Child.java:264)
> Caused by: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
> 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
> 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
> 	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
> 	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
> 	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
> 	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077)
> 	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1356)
> 	at com.cloudera.sqoop.mapreduce.AsyncSqlOutputFormat$AsyncSqlExecThread.run(AsyncSqlOutputFormat.java:232)
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SQOOP-352) Export of avro data imported from database table (using sqoop import) fails on year

Posted by "jiraposter@reviews.apache.org (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SQOOP-352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13223758#comment-13223758 ] 

jiraposter@reviews.apache.org commented on SQOOP-352:
-----------------------------------------------------


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

Ship it!


+1

- Arvind


On 2012-03-02 22:48:24, Bilung Lee wrote:
bq.  
bq.  -----------------------------------------------------------
bq.  This is an automatically generated e-mail. To reply, visit:
bq.  https://reviews.apache.org/r/3845/
bq.  -----------------------------------------------------------
bq.  
bq.  (Updated 2012-03-02 22:48:24)
bq.  
bq.  
bq.  Review request for Sqoop, Arvind Prabhakar, Tom White, and Jarek Cecho.
bq.  
bq.  
bq.  Summary
bq.  -------
bq.  
bq.  MySQL YEAR is mapped to java.sql.Date when importing to HDFS. On the way back an exception is thrown because the date and month fields are truncated (not used) - this is the MySQL behaviour.
bq.  
bq.  
bq.  This addresses bug SQOOP-352.
bq.      https://issues.apache.org/jira/browse/SQOOP-352
bq.  
bq.  
bq.  Diffs
bq.  -----
bq.  
bq.    ./src/java/org/apache/sqoop/hive/TableDefWriter.java 1296490 
bq.    ./src/java/org/apache/sqoop/manager/ConnManager.java 1296490 
bq.    ./src/java/org/apache/sqoop/manager/MySQLManager.java 1296490 
bq.    ./src/java/org/apache/sqoop/manager/OracleManager.java 1296490 
bq.    ./src/java/org/apache/sqoop/manager/SqlManager.java 1296490 
bq.    ./src/java/org/apache/sqoop/mapreduce/JdbcExportJob.java 1296490 
bq.    ./src/java/org/apache/sqoop/orm/AvroSchemaGenerator.java 1296490 
bq.    ./src/java/org/apache/sqoop/orm/ClassWriter.java 1296490 
bq.    ./src/test/com/cloudera/sqoop/manager/MySQLCompatTest.java 1296490 
bq.  
bq.  Diff: https://reviews.apache.org/r/3845/diff
bq.  
bq.  
bq.  Testing
bq.  -------
bq.  
bq.  
bq.  Thanks,
bq.  
bq.  Bilung
bq.  
bq.


                
> Export of avro data imported from database table (using sqoop import) fails on year
> -----------------------------------------------------------------------------------
>
>                 Key: SQOOP-352
>                 URL: https://issues.apache.org/jira/browse/SQOOP-352
>             Project: Sqoop
>          Issue Type: Bug
>          Components: connectors/mysql
>            Reporter: Tom White
>            Assignee: Bilung Lee
>         Attachments: SQOOP-352.patch
>
>
> Report from Wing Yew Poon:
> I use a MySQL database for testing sqoop. I created a table with a representative collection of data types for the columns, excluding blob and text (and their different-sized variants).
> I run sqoop import --as-avrodatafile to import the table into hdfs.
> I create a second table with the same schema, and run sqoop export to export the avro data to this second table. The export fails with
> {noformat}
> java.io.IOException: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
> 	at com.cloudera.sqoop.mapreduce.AsyncSqlRecordWriter.close(AsyncSqlRecordWriter.java:180)
> 	at org.apache.hadoop.mapred.MapTask$NewDirectOutputCollector.close(MapTask.java:540)
> 	at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:649)
> 	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
> 	at org.apache.hadoop.mapred.Child$4.run(Child.java:270)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at javax.security.auth.Subject.doAs(Subject.java:396)
> 	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1127)
> 	at org.apache.hadoop.mapred.Child.main(Child.java:264)
> Caused by: java.sql.SQLException: Data truncated for column 'yyyy' at row 1
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
> 	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
> 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
> 	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
> 	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
> 	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
> 	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
> 	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077)
> 	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1356)
> 	at com.cloudera.sqoop.mapreduce.AsyncSqlOutputFormat$AsyncSqlExecThread.run(AsyncSqlOutputFormat.java:232)
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira