[
https://issues.apache.org/jira/browse/CASSANDRA-14337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17427231#comment-17427231
]
Andres de la Peña commented on CASSANDRA-14337:
-----------------------------------------------
Here is the patch:
||PR||CI||
|[trunk|https://github.com/apache/cassandra/pull/1264]|[j8|https://app.circleci.com/pipelines/github/adelapena/cassandra/993/workflows/9ad2da3c-fd2f-43dd-8e7f-0049855857d7]
[j11|https://app.circleci.com/pipelines/github/adelapena/cassandra/993/workflows/989c009b-afc5-4673-94a9-def3525219ae]|
It adds support for using the {{CAST}} functions in {{INSER}} and {{UPDATE}}
statements, and in the values of {{WHERE}} clauses, for example:
{code:java}
INSERT INTO t (k, v) VALUES (0, CAST(currentDate() AS TEXT));
UPDATE t SET v = CAST(now() AS TEXT) WHERE k = 1;
UPDATE t SET v = 'a' WHERE k = CAST(2.1 AS INT);
SELECT * FROM t WHERE k = CAST(2.2 AS INT);
DELETE FROM t WHERE k = CAST(2.3 AS INT);
CREATE MATERIALIZED VIEW mv AS SELECT * FROM t
WHERE k > CAST(2.3 AS INT) AND v IS NOT NULL
PRIMARY KEY (v, k);
{code}
The CI results above include 1000 runs of the new and modified tests in
{{CastFctsTest}}.
Since this is an improvement adding a new feature the patch is only for
{{trunk}}.
> cast function is not working in INSERT statement
> ------------------------------------------------
>
> Key: CASSANDRA-14337
> URL: https://issues.apache.org/jira/browse/CASSANDRA-14337
> Project: Cassandra
> Issue Type: Improvement
> Components: Legacy/CQL
> Environment: cqlsh
> Reporter: Rakesh Roshan
> Assignee: Andres de la Peña
> Priority: Normal
> Fix For: 4.x
>
>
> INSERT INTO test.table(last_modified) values(cast(
> ('2018-03-20 13:05:56.063000+0000' as timestamp));
>
> fails with error
> *no viable alternative at input '('*
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]