[
https://issues.apache.org/jira/browse/CASSANDRA-11798?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alex Petrov updated CASSANDRA-11798:
------------------------------------
Status: Patch Available (was: Open)
Since the issue is marked as an improvement, I've made a patch to {{3.0}},
{{3.7}} and {{trunk}} (patch clearly merges to all three branches).
Documentation already mentions that it is allowed to specify the long, so it
was not changed.
||[trunk|https://github.com/ifesdjeen/cassandra/tree/11798-trunk]|[utest|https://cassci.datastax.com/view/Dev/view/ifesdjeen/job/ifesdjeen-11798-trunk-testall/]|[dtest|https://cassci.datastax.com/view/Dev/view/ifesdjeen/job/ifesdjeen-11798-trunk-dtest/]|
||[3.7|https://github.com/ifesdjeen/cassandra/tree/11798-3.7]|[utest|https://cassci.datastax.com/view/Dev/view/ifesdjeen/job/ifesdjeen-11798-3.7-testall/]|[dtest|https://cassci.datastax.com/view/Dev/view/ifesdjeen/job/ifesdjeen-11798-3.7-dtest/]|
||[3.0|https://github.com/ifesdjeen/cassandra/tree/11798-3.0]|[utest|https://cassci.datastax.com/view/Dev/view/ifesdjeen/job/ifesdjeen-11798-3.0-testall/]|[dtest|https://cassci.datastax.com/view/Dev/view/ifesdjeen/job/ifesdjeen-11798-3.0-dtest/]|
> Allow specification of 'time' column value as number in CQL query.
> ------------------------------------------------------------------
>
> Key: CASSANDRA-11798
> URL: https://issues.apache.org/jira/browse/CASSANDRA-11798
> Project: Cassandra
> Issue Type: Improvement
> Components: CQL
> Reporter: Andy Tolbert
> Assignee: Alex Petrov
> Priority: Minor
>
> The 'time' cql type is internally stored and sent over the protocol as an
> 8-byte long value representing nanoseconds since midnight.
> When specifying a time column value as a number in a simple statement,, C*
> currently responds with:
> {noformat}
> InvalidRequest: code=2200 [Invalid query] message="Invalid INTEGER constant
> (42000000000) for "time" of type time"
> {noformat}
> Instead one must provide this value as a string (i.e. {{'42000000000'}}) or
> use an {{HH.MM.SS.sssssssss}} format (i.e. {{'00:00:42.000000000'}}). It
> would be nice if it supported unquoted numbers as well.
> Example:
> {code}
> cqlsh:simple> CREATE TABLE timeentity (id varchar PRIMARY KEY, time time);
> # Doesn't work
> cqlsh:simple> INSERT into timeentity (id, time) values ('1', 42000000000);
> InvalidRequest: code=2200 [Invalid query] message="Invalid INTEGER constant
> (42000000000) for "time" of type time"
> # Works
> cqlsh:simple> INSERT into timeentity (id, time) values ('1', '42000000000');
> {code}
> When using prepared statements or simple statements with parameters, one
> could provide a long value, depending on the driver implementation. I.E. the
> java driver has {{setTime(int index, long v)}}.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)