hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Syed Shameerur Rahman (Jira)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-22368) Hive JDBC Storage Handler: some mysql data type can not be cast to hive data type
Date Tue, 29 Oct 2019 15:48:00 GMT

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

Syed Shameerur Rahman commented on HIVE-22368:
----------------------------------------------

[~zhangbutao] Correct me if i am wrong, I don't find this issue with the current hive master
branch

> Hive JDBC Storage Handler: some mysql data type can not be cast to hive data type
> ---------------------------------------------------------------------------------
>
>                 Key: HIVE-22368
>                 URL: https://issues.apache.org/jira/browse/HIVE-22368
>             Project: Hive
>          Issue Type: Bug
>    Affects Versions: 3.1.0, 4.0.0, 3.1.1
>            Reporter: zhangbutao
>            Assignee: zhangbutao
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 4.0.0
>
>         Attachments: HIVE-22368.01.patch
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Mysql data type(date、timestamp、decimal)can not be cast to hive data type(date、timestamp、decimal)。
> step to repo(take date type for example):
> {code:java}
> //MySQL table:
> create table testdate(id date);
> //Hive table:
> CREATE EXTERNAL TABLE `hive_date`(               
>       id date )    
>     ROW FORMAT SERDE                                   
>       'org.apache.hive.storage.jdbc.JdbcSerDe'         
>     STORED BY                                          
>       'org.apache.hive.storage.jdbc.JdbcStorageHandler'                       
>     TBLPROPERTIES (                                                            
>       'hive.sql.database.type'='MYSQL',                                  
>       'hive.sql.dbcp.password'='hive',             
>       'hive.sql.dbcp.username'='hive',             
>       'hive.sql.jdbc.driver'='com.mysql.jdbc.Driver',  
>       'hive.sql.jdbc.url'='jdbc:mysql://hadoop/test',  
>       'hive.sql.table'='testdate');
> //Hive query:
> select * from hive_date;
> Error: java.io.IOException: org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.ClassCastException:
java.sql.Date cannot be cast to org.apache.hadoop.hive.common.type.Date (state=,code=0)
> //Error stack trace
> Caused by: java.lang.ClassCastException: java.sql.Date cannot be cast to org.apache.hadoop.hive.common.type.Date
>         at org.apache.hadoop.hive.serde2.objectinspector.primitive.JavaDateObjectInspector.getPrimitiveJavaObject(JavaDateObjectInspector.java:41)
~[hive-exec-3.1.0-bc3.0.1.jar:3.1.0-bc3.0.1]
>         at org.apache.hadoop.hive.serde2.objectinspector.primitive.JavaDateObjectInspector.getPrimitiveJavaObject(JavaDateObjectInspector.java:27)
~[hive-exec-3.1.0-bc3.0.1.jar:3.1.0-bc3.0.1]
>         at org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils.copyToStandardObject(ObjectInspectorUtils.java:422)
~[hive-exec-3.1.0-bc3.0.1.jar:3.1.0-bc3.0.1]
>         at org.apache.hadoop.hive.serde2.SerDeUtils.toThriftPayload(SerDeUtils.java:173)
~[hive-exec-3.1.0-bc3.0.1.jar:3.1.0-bc3.0.1]
>         at org.apache.hadoop.hive.serde2.thrift.ThriftFormatter.convert(ThriftFormatter.java:49)
~[hive-exec-3.1.0-bc3.0.1.jar:3.1.0-bc3.0.1]
>         at org.apache.hadoop.hive.ql.exec.ListSinkOperator.process(ListSinkOperator.java:94)
~[hive-exec-3.1.0-bc3.0.1.jar:3.1.0-bc3.0.1]
>         at org.apache.hadoop.hive.ql.exec.Operator.baseForward(Operator.java:995) ~[hive-exec-3.1.0-bc3.0.1.jar:3.1.0-bc3.0.1]
>         at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:941) ~[hive-exec-3.1.0-bc3.0.1.jar:3.1.0-bc3.0.1]
>         at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:928) ~[hive-exec-3.1.0-bc3.0.1.jar:3.1.0-bc3.0.1]
>         at org.apache.hadoop.hive.ql.exec.SelectOperator.process(SelectOperator.java:95)
~[hive-exec-3.1.0-bc3.0.1.jar:3.1.0-bc3.0.1]
>         at org.apache.hadoop.hive.ql.exec.Operator.baseForward(Operator.java:995) ~[hive-exec-3.1.0-bc3.0.1.jar:3.1.0-bc3.0.1]
>         at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:941) ~[hive-exec-3.1.0-bc3.0.1.jar:3.1.0-bc3.0.1]
>         at org.apache.hadoop.hive.ql.exec.TableScanOperator.process(TableScanOperator.java:125)
~[hive-exec-3.1.0-bc3.0.1.jar:3.1.0-bc3.0.1]
>         at org.apache.hadoop.hive.ql.exec.FetchOperator.pushRow(FetchOperator.java:519)
~[hive-exec-3.1.0-bc3.0.1.jar:3.1.0-bc3.0.1]
>         at org.apache.hadoop.hive.ql.exec.FetchOperator.pushRow(FetchOperator.java:511)
~[hive-exec-3.1.0-bc3.0.1.jar:3.1.0-bc3.0.1]
>         at org.apache.hadoop.hive.ql.exec.FetchTask.fetch(FetchTask.java:146) ~[hive-exec-3.1.0-bc3.0.1.jar:3.1.0-bc3.0.1]
>         at org.apache.hadoop.hive.ql.Driver.getResults(Driver.java:2706) ~[hive-exec-3.1.0-bc3.0.1.jar:3.1.0-bc3.0.1]
>         at org.apache.hadoop.hive.ql.reexec.ReExecDriver.getResults(ReExecDriver.java:229)
~[hive-exec-3.1.0-bc3.0.1.jar:3.1.0-bc3.0.1]
>         at org.apache.hive.service.cli.operation.SQLOperation.getNextRowSet(SQLOperation.java:460)
~[hive-service-3.1.0-bc3.0.1.jar:3.1.0-bc3.0.1]
>         ... 25 more
> {code}



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

Mime
View raw message