Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-17915

Confusing error message when using ? with functions

    XMLWordPrintableJSON

Details

    Description

      INSERT INTO %S (a, b, c) VALUES (? + 1, ?, ?)
      

      Errors saying

      Ambiguous '+' operation with args ? and 1: use type casts to disambiguate
      

      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

      CAST( selector AS to_type )
      

      But this also fails!

      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
      

      What we have to do is

      INSERT INTO %S (a, b, c) VALUES ((int) ? + 1, ?, ?)
      

      We should improve the error message to show the expected syntax (or fix CAST to work in this case).

      Attachments

        Issue Links

          Activity

            People

              NateAdere Natnael Adere
              dcapwell David Capwell
              Natnael Adere
              Benjamin Lerer, Brandon Williams
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 40m
                  1h 40m