cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Krumpholz (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-4628) CQL/JDBC: date vs. timestamp issues
Date Fri, 07 Sep 2012 11:22:08 GMT

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

Michael Krumpholz commented on CASSANDRA-4628:
----------------------------------------------

The JdbcDate class is not part of the jdbc driver package which is a separate project at google
(as you mentioned in my other issue). But the getType there returns the JDBC datatype (from
java.sql.Types) that is returned in the metadata according to the jdbc spec. The problem is
that Types.DATE is the wrong type. It should be Types.TIMESTAMP because the data can be more
that just a date, it can be a timestamp. Using ResultSet.getDate() because of the returned
type cuts off the time part of the timestamp. JDBC has the date time distinction, cassandra
not. in short words, but i assume you are aware of this: date != timestamp, timestamp = date
+ time
                
> CQL/JDBC: date vs. timestamp issues
> -----------------------------------
>
>                 Key: CASSANDRA-4628
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4628
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 1.1.4
>            Reporter: Michael Krumpholz
>            Priority: Critical
>              Labels: cql, jdbc
>
> Cassandra's datatypes only have one Date/Time type named timestamp containing both date
and time. Calling the validator org.apache.cassandra.db.marshal.DateType might be OK in general
but can be confusing in the jdbc context where there is a distinction between date, time and
timestamp. In terms of jdbc there should be more datatypes for dates and times or the jdbc
driver should take one of the following options:
> - stick to timestamp
> - check if the date has a time part and distinguish by the data between date and timestamp
automatically
> - use distinct datatypes according to the jdbc spec, the types would need to be in cassandra
then too
> Now back to my actual problem:
> org.apache.cassandra.cql.jdbc.JdbcDate returns Types.DATE in getType(). Even if having
inserted a complete date with time (making it a timestamp) the ResultSetMetaData.getColumnType()
implementation still returns Types.DATE (source of this is in JdbcDate). If some other java
code (where i don't have access to) uses the metadata to get the type and then getDate() to
get the value the time is cut off the value and only the date is returned.
> But the ResultSet.getObject() implementation returns a complete java.util.Date including
the time.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message