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

Alex Newman commented on SQOOP-341:
-----------------------------------

I'm guessing since hive has no notion of a unsigned type, we should just use a 
bigint for unsigned types. We may also have to do some work to actually get 
mysql to tell us that it's an unsigned int, as signed/unsigned is a foreign 
concept in jdbc.

> Sqoop doesn't handle unsigned ints at least with MySQL
> ------------------------------------------------------
>
>                 Key: SQOOP-341
>                 URL: https://issues.apache.org/jira/browse/SQOOP-341
>             Project: Sqoop
>          Issue Type: Bug
>            Reporter: Alex Newman
>            Assignee: Alex Newman
>
> mysql> describe Inventory;
> +-----------+-------------------------------+------+-----+---------+-------+
> | Field     | Type                          | Null | Key | Default | Extra |
> +-----------+-------------------------------+------+-----+---------+-------+
> | ProductID | smallint(4) unsigned zerofill | YES  |     | NULL    |       |
> | Quantity  | int(10) unsigned              | YES  |     | NULL    |       |
> +-----------+-------------------------------+------+-----+---------+-------+
> 2 rows in set (0.00 sec)
> mysql> insert into Inventory Values (9999,9999999999);
> Query OK, 1 row affected, 1 warning (0.00 sec)
> mysql> select * from Inventory;
> +-----------+------------+
> | ProductID | Quantity   |
> +-----------+------------+
> |      9999 | 4294967295 |
> +-----------+------------+
> Get's the following error
> ava.io.IOException: SQLException in nextKeyValue
>         at 
> org.apache.sqoop.mapreduce.db.DBRecordReader.nextKeyValue(DBRecordReader.java:248)
>         at 
> org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.nextKeyValue(MapTask.java:456)
>         at 
> org.apache.hadoop.mapreduce.MapContext.nextKeyValue(MapContext.java:67)
>         at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:143)
>         at 
> org.apache.sqoop.mapreduce.AutoProgressMapper.run(AutoProgressMapper.java:188)
>         at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:647)
>         at org.apache.hadoop.mapred.MapTask.run(MapTask.java:323)
>         at 
> org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:210)
> Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLDataException: 
> '4.294967295E9' in column '2' is outside valid range for the datatype INTEGER.
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
> Method)
>         at 
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>         at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>         at com.mysql.jdbc.Util.handleNewInstance(Util.java:407)
>         at com.mysql.jdbc.Util.getInstance(Util.java:382)
>         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1025)
>         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
>         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982)
>         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)
>         at 
> com.mysql.jdbc.ResultSetImpl.throwRangeException(ResultSetImpl.java:7970)
>         at 
> com.mysql.jdbc.ResultSetImpl.parseIntAsDouble(ResultSetImpl.java:7199)
>         at com.mysql.jdbc.ResultSetImpl.getInt(ResultSetImpl.java:2702)
>         at 
> org.apache.sqoop.lib.JdbcWritableBridge.readInteger(JdbcWritableBridge.java:51)
>         at Inventory.readFields(Inventory.java:75)
>         at 
> org.apache.sqoop.mapreduce.db.DBRecordReader.nextKeyValue(DBRecordReader.java:244)
>         ... 7 more
> This seems to be caused by sqoop having no notion of unsigned values when 
> importing from MySQL(or maybe in general)

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

        

Reply via email to