We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jira Link: DB-4715 Seeing this error on toUnixTimestamp(now()) -> timestamp conversion.
9:47 $ ~/yugabyte-1.1.0.5/bin/cqlsh Connected to local cluster at 127.0.0.1:9042. [cqlsh 5.0.1 | Cassandra 3.9-SNAPSHOT | CQL spec 3.4.2 | Native protocol v4] Use HELP for help. cqlsh> create keyspace k; cqlsh> use k; cqlsh:k> CREATE TABLE sample_times (a int, b timestamp, c timeuuid, d bigint, PRIMARY KEY (a,b,c,d)); cqlsh:k> INSERT INTO sample_times (a,b,c,d) VALUES (1, toUnixTimestamp(now()), 50554d6e-29bb-11e5-b345-feff819cdc9f, toTimestamp(now())); InvalidRequest: Error from server: code=2200 [Invalid query] message="SQL error: Datatype Mismatch. Cannot cast builtin call return type 'bigint' to expected type 'timestamp' INSERT INTO sample_times (a,b,c,d) VALUES (1, toUnixTimestamp(now()), 50554d6e-29bb-11e5-b345-feff819cdc9f, toTimestamp(now())); ^^^^^^^^^^^^^^^ (error -201)"
The text was updated successfully, but these errors were encountered:
The example above is from:
https://docs.datastax.com/en/cql/3.3/cql/cql_reference/timeuuid_functions_r.html
But it seems like the expressions for "b" & "d" columns in the doc is flipped.
The workaround would be:
cqlsh:k> INSERT INTO sample_times (a,b,c,d) VALUES (1, toTimestamp(now()), 50554d6e-29bb-11e5-b345-feff819cdc9f, toUnixTimestamp(now())); cqlsh:k> select * from sample_times; a | b | c | d ---+---------------------------------+--------------------------------------+--------------- 1 | 2018-11-12 20:15:44.504000+0000 | 50554d6e-29bb-11e5-b345-feff819cdc9f | 1542053744505
But looks like Apache Cassandra supports implicit conversions that YCQL isn't.
Sorry, something went wrong.
suranjan
No branches or pull requests
Jira Link: DB-4715
Seeing this error on toUnixTimestamp(now()) -> timestamp conversion.
The text was updated successfully, but these errors were encountered: