cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Tolbert (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CASSANDRA-11798) Allow specification of 'time' column value as number in CQL query.
Date Thu, 12 May 2016 18:40:12 GMT

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

Andy Tolbert updated CASSANDRA-11798:
-------------------------------------
    Description: 
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)}}.

  was:
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)}}.


> 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
>            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)

Mime
View raw message