You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Natnael Adere (Jira)" <ji...@apache.org> on 2022/10/03 17:46:00 UTC

[jira] [Commented] (CASSANDRA-17915) Confusing error message when using ? with functions

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

Natnael Adere commented on CASSANDRA-17915:
-------------------------------------------

This is the pull request for the patch: https://github.com/apache/cassandra/pull/1889

> Confusing error message when using ? with functions
> ---------------------------------------------------
>
>                 Key: CASSANDRA-17915
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-17915
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: CQL/Interpreter
>            Reporter: David Capwell
>            Assignee: Natnael Adere
>            Priority: Normal
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> {code}
> INSERT INTO %S (a, b, c) VALUES (? + 1, ?, ?)
> {code}
> Errors saying
> {code}
> Ambiguous '+' operation with args ? and 1: use type casts to disambiguate
> {code}
> Now, if you google “type casts CQL” you get https://docs.datastax.com/en/dse/5.1/cql/cql/cql_reference/refCqlFunction.html which says to do
> {code}
> CAST( selector AS to_type )
> {code}
> But this also fails!
> {code}
> InvalidRequestException: Ambiguous call to function system.castAsFloat (can be matched by following signatures: system."castAsFloat" : (bigint) -> float, system."castAsFloat" : (counter) -> float, system."castAsFloat" : (double) -> float, system."castAsFloat" : (int) -> float, system."castAsFloat" : (tinyint) -> float, system."castAsFloat" : (varint) -> float, system."castAsFloat" : (decimal) -> float, system."castAsFloat" : (smallint) -> float): use type casts to disambiguate
> {code}
> What we have to do is 
> {code}
> INSERT INTO %S (a, b, c) VALUES ((int) ? + 1, ?, ?)
> {code}
> We should improve the error message to show the expected syntax (or fix CAST to work in this case).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org