You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sqoop.apache.org by "Sergey Svinarchuk (JIRA)" <ji...@apache.org> on 2016/08/18 09:53:20 UTC

[jira] [Updated] (SQOOP-3001) Import from Mysql broken with "Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.math.BigDecimal"

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

Sergey Svinarchuk updated SQOOP-3001:
-------------------------------------
    Description: 
After patch from SQOOP-2244, Sqoop incorrect get type for column.
Example for select with automatically escape column names:
{code}
mysql> create table test (id int);
Query OK, 0 rows affected (0.01 sec)

mysql> insert into test value (1);
Query OK, 1 row affected (0.04 sec)

mysql> insert into test value (9);
Query OK, 1 row affected (0.01 sec)

mysql> select min("id"), max("id") from test;
+-----------+-----------+
| min("id") | max("id") |
+-----------+-----------+
| id           | id        |
+-----------+-----------+
1 row in set (0.00 sec)
{code}

But real results must be:
{code}
mysql> select min(id), max(id) from test;
+---------+---------+
| min(id) | max(id) |
+---------+---------+
|       1   |    9     |
+---------+---------+
1 row in set (0.00 sec)
{code}
So when we use auto escape, Sqoop getting String value for int column in Mysql

  was:
After patch from SQOOP-2244, Sqoop incorrect get type for column.
Example for select with automatically escape column names:
{code}
mysql> create table test (id int);
Query OK, 0 rows affected (0.01 sec)

mysql> insert into test value (1);
Query OK, 1 row affected (0.04 sec)

mysql> insert into test value (9);
Query OK, 1 row affected (0.01 sec)

mysql> select min("id"), max("id") from test;
+-----------+-----------+
| min("id") | max("id") |
+-----------+-----------+
| id            | id            |
+-----------+-----------+
1 row in set (0.00 sec)
{code}

But real results must be:
{code}
mysql> select min(id), max(id) from test;
+---------+---------+
| min(id) | max(id) |
+---------+---------+
|       1    |       9     |
+---------+---------+
1 row in set (0.00 sec)
{code}
So when we use auto escape, Sqoop getting String value for int column in Mysql


> Import from Mysql broken with "Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.math.BigDecimal"
> ---------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SQOOP-3001
>                 URL: https://issues.apache.org/jira/browse/SQOOP-3001
>             Project: Sqoop
>          Issue Type: Bug
>          Components: connectors/generic
>    Affects Versions: 1.99.7
>            Reporter: Sergey Svinarchuk
>
> After patch from SQOOP-2244, Sqoop incorrect get type for column.
> Example for select with automatically escape column names:
> {code}
> mysql> create table test (id int);
> Query OK, 0 rows affected (0.01 sec)
> mysql> insert into test value (1);
> Query OK, 1 row affected (0.04 sec)
> mysql> insert into test value (9);
> Query OK, 1 row affected (0.01 sec)
> mysql> select min("id"), max("id") from test;
> +-----------+-----------+
> | min("id") | max("id") |
> +-----------+-----------+
> | id           | id        |
> +-----------+-----------+
> 1 row in set (0.00 sec)
> {code}
> But real results must be:
> {code}
> mysql> select min(id), max(id) from test;
> +---------+---------+
> | min(id) | max(id) |
> +---------+---------+
> |       1   |    9     |
> +---------+---------+
> 1 row in set (0.00 sec)
> {code}
> So when we use auto escape, Sqoop getting String value for int column in Mysql



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