carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Liang Chen (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CARBONDATA-1461) Unable to Read Date And TimeStamp Type in HIve
Date Thu, 07 Sep 2017 13:20:00 GMT

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

Liang Chen resolved CARBONDATA-1461.
------------------------------------
    Resolution: Fixed

> Unable to Read Date And TimeStamp Type in HIve
> ----------------------------------------------
>
>                 Key: CARBONDATA-1461
>                 URL: https://issues.apache.org/jira/browse/CARBONDATA-1461
>             Project: CarbonData
>          Issue Type: Bug
>          Components: hive-integration
>    Affects Versions: 1.2.0
>         Environment: hive1.21.,spark 2.1
>            Reporter: anubhav tarar
>            Assignee: anubhav tarar
>            Priority: Trivial
>             Fix For: 1.2.0
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
>     val connection = DriverManager.getConnection(s"jdbc:hive2://localhost:$port/default",
"", "")
>     val statement: Statement = connection.createStatement
>     logger.info(s"============HIVE CLI IS STARTED ON PORT $port ==============")
>     statement.execute("CREATE TABLE IF NOT EXISTS carbon_table(shortField SMALLINT,intField
INT,bigintField " +
>                       "bigint,doubleField DOUBLE,stringField STRING,timestampField TIMESTAMP,"
+
>                       "decimalField DECIMAL(18,2),dateField DATE,\n charField CHAR(5),floatField
" +
>                       "double,complexData ARRAY<STRING>)")
>     statement
>       .execute(
>         "ALTER TABLE carbon_table SET FILEFORMAT INPUTFORMAT \"org.apache.carbondata."
+
>         "hive.MapredCarbonInputFormat\"OUTPUTFORMAT \"org.apache.carbondata.hive." +
>         "MapredCarbonOutputFormat\"SERDE \"org.apache.carbondata.hive." +
>         "CarbonHiveSerDe\" ")
>     statement
>       .execute(
>         "ALTER TABLE carbon_table SET LOCATION 'file:///home/vinod/Desktop/carbondata/examples/spark2/target/store/default/carbon_table'
")
>     val sql = "SELECT dateField FROM carbon_table"
>     val resultSet: ResultSet = statement.executeQuery(sql)
>      logs
> exception in thread "main" org.apache.hive.service.cli.HiveSQLException: 
> java.io.IOException: java.lang.ClassCastException: java.lang.Integer cannot be cast to
java.lang.Long
> 	at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:256)
> 	at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:242)
> 	at org.apache.hive.jdbc.HiveQueryResultSet.next(HiveQueryResultSet.java:365)
> when i tried to read timestamp type it gives error 
>  val sql = "SELECT timestampField FROM carbon_table"
>     val resultSet: ResultSet = statement.executeQuery(sql)
>     var rowsFetched = 0
>     while (resultSet.next) {
> println("*****"+resultSet.getString("timestampField"))
> }
> java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message