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

Cast functions do not work properly on Counter columns

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 3.2
    • Legacy/CQL
    • None
    • Normal

    Description

      The problem can be reproduced with the following unit test:

          @Test
          public void testCounterCastsInSelectionClause() throws Throwable
          {
              createTable("CREATE TABLE %s (a int primary key, b counter)");
      
              execute("UPDATE %s SET b = b + 2 WHERE a = 1");
      
              assertRows(execute("SELECT CAST(b AS tinyint), " +
                      "CAST(b AS smallint), " +
                      "CAST(b AS int), " +
                      "CAST(b AS bigint), " +
                      "CAST(b AS float), " +
                      "CAST(b AS double), " +
                      "CAST(b AS decimal), " +
                      "CAST(b AS ascii), " +
                      "CAST(b AS text) FROM %s"),
                         row((byte) 2, (short) 2, 2, 2L, 2.0F, 2.0, BigDecimal.valueOf(2.0), "2", "2"));
          }
      

      Attachments

        1. 10824-trunk.txt
          6 kB
          Benjamin Lerer

        Activity

          People

            blerer Benjamin Lerer
            blerer Benjamin Lerer
            Benjamin Lerer
            Robert Stupp
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: