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

Cqlsh incorrectly formats duration

    XMLWordPrintableJSON

Details

    Description

      It looks like something broke between C* 3.11 and C* 4.X when it comes to duration types.

      Example:

      CREATE KEYSPACE users WITH replication = {'class': 'NetworkTopologyStrategy', 'datacenter1': '1'} AND durable_writes = true;
      CREATE TABLE users.user_credentials_by_email (email text,la_duration duration,PRIMARY KEY(email));
      INSERT INTO users.user_credentials_by_email (email, la_duration ) VALUES ( 'test0@test.com', 12h);
      INSERT INTO users.user_credentials_by_email (email, la_duration ) VALUES ( 'test1@test.com', 12h30m);
      INSERT INTO users.user_credentials_by_email (email, la_duration ) VALUES ( 'test2@test.com', 12h30m30s);
      INSERT INTO users.user_credentials_by_email (email, la_duration ) VALUES ( 'test3@test.com', 12h30m30s250ms);
      INSERT INTO users.user_credentials_by_email (email, la_duration ) VALUES ( 'test4@test.com', PT12H30M);

      3.11:

      cassandra@cqlsh> SHOW VERSION ;
      [cqlsh 5.0.1 | Cassandra 3.11.15-SNAPSHOT | CQL spec 3.4.4 | Native protocol v4]
      cassandra@cqlsh> SELECT * FROM users.user_credentials_by_email ;

       email          | la_duration
      ---------------+---------------
       test0@test.com |            12h
       test3@test.com | 12h30m30s250ms
       test4@test.com |         12h30m
       test1@test.com |         12h30m
       test2@test.com |      12h30m30s

      (5 rows)

      4.X:

      cassandra@cqlsh> SHOW VERSION ;
      [cqlsh 6.0.0 | Cassandra 4.0.8-SNAPSHOT | CQL spec 3.4.5 | Native protocol v5]
      cassandra@cqlsh> SELECT * FROM users.user_credentials_by_email ;

       email          | la_duration
      ---------------+----------------------------------------------------
       test0@test.com |                                               12.0h
       test3@test.com | 12.508402777777778h30.504166666666666m30.25s250.0ms
       test4@test.com |                                          12.5h30.0m
       test1@test.com |                                          12.5h30.0m
       test2@test.com |                       12.508333333333333h30.5m30.0s

      (5 rows)

      Attachments

        Activity

          People

            masokol Maciej Sokol
            masokol Maciej Sokol
            Maciej Sokol
            Brandon Williams, Ekaterina Dimitrova
            Votes:
            0 Vote for this issue
            Watchers:
            2 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 - 20m
                20m