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

Syed Shameerur Rahman updated HIVE-22431:
-----------------------------------------
    Description: 
Steps to Reproduce:
{code:java}
//MySQL table:
create table testtbl(a TINYINT, b SMALLINT);

// Insert to table via mysql connector

//Hive table:
CREATE EXTERNAL TABLE `hive_table`(               
      a TINYINT, b SMALLINT
 )           
    STORED BY                                          
      'org.apache.hive.storage.jdbc.JdbcStorageHandler'                       
    TBLPROPERTIES (                                                            
      'hive.sql.database.type'='MYSQL',                                  
      'hive.sql.dbcp.password'='',             
      'hive.sql.dbcp.username'='',             
      'hive.sql.jdbc.driver'='com.mysql.jdbc.Driver',  
      'hive.sql.jdbc.url'='',  
      'hive.sql.table'='testtbl');

//Hive query:
select * from hive_table;


{code}
*Failed with exception 
java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: 
java.lang.ClassCastException: java.lang.Integer cannot be cast to 
java.lang.Byte*

*Failed with exception 
java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: 
java.lang.ClassCastException: java.lang.Integer cannot be cast to 
java.lang.Short*
{code:java}
 {code}

  was:
Steps to Reproduce:
{code:java}
//MySQL table:
create table testtbl(a TINYINT, b SMALLINT);

// Insert to table

//Hive table:
CREATE EXTERNAL TABLE `hive_table`(               
      a TINYINT, b SMALLINT
 )           
    STORED BY                                          
      'org.apache.hive.storage.jdbc.JdbcStorageHandler'                       
    TBLPROPERTIES (                                                            
      'hive.sql.database.type'='MYSQL',                                  
      'hive.sql.dbcp.password'='',             
      'hive.sql.dbcp.username'='',             
      'hive.sql.jdbc.driver'='com.mysql.jdbc.Driver',  
      'hive.sql.jdbc.url'='',  
      'hive.sql.table'='testtbl');

//Hive query:
select * from hive_table;


{code}
*Failed with exception 
java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: 
java.lang.ClassCastException: java.lang.Integer cannot be cast to 
java.lang.Byte*

*Failed with exception 
java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: 
java.lang.ClassCastException: java.lang.Integer cannot be cast to 
java.lang.Short*
{code:java}
 {code}


> Hive JDBC Storage Handler: java.lang.ClassCastException on accessing TINYINT, 
> SMALLINT Data Type From JDBC Data Source
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-22431
>                 URL: https://issues.apache.org/jira/browse/HIVE-22431
>             Project: Hive
>          Issue Type: Bug
>          Components: StorageHandler
>            Reporter: Syed Shameerur Rahman
>            Assignee: Syed Shameerur Rahman
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: HIVE-22431.01.patch
>
>
> Steps to Reproduce:
> {code:java}
> //MySQL table:
> create table testtbl(a TINYINT, b SMALLINT);
> // Insert to table via mysql connector
> //Hive table:
> CREATE EXTERNAL TABLE `hive_table`(               
>       a TINYINT, b SMALLINT
>  )           
>     STORED BY                                          
>       'org.apache.hive.storage.jdbc.JdbcStorageHandler'                       
>     TBLPROPERTIES (                                                           
>  
>       'hive.sql.database.type'='MYSQL',                                  
>       'hive.sql.dbcp.password'='',             
>       'hive.sql.dbcp.username'='',             
>       'hive.sql.jdbc.driver'='com.mysql.jdbc.Driver',  
>       'hive.sql.jdbc.url'='',  
>       'hive.sql.table'='testtbl');
> //Hive query:
> select * from hive_table;
> {code}
> *Failed with exception 
> java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: 
> java.lang.ClassCastException: java.lang.Integer cannot be cast to 
> java.lang.Byte*
> *Failed with exception 
> java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: 
> java.lang.ClassCastException: java.lang.Integer cannot be cast to 
> java.lang.Short*
> {code:java}
>  {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to