Maciej Sokol created CASSANDRA-18141:
----------------------------------------

             Summary: Cqlsh incorrectly formats duration
                 Key: CASSANDRA-18141
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18141
             Project: Cassandra
          Issue Type: Bug
          Components: Tool/cqlsh
            Reporter: Maciej Sokol


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 ( 
'te...@test.com', 12h);
INSERT INTO users.user_credentials_by_email (email, la_duration ) VALUES ( 
'te...@test.com', 12h30m);
INSERT INTO users.user_credentials_by_email (email, la_duration ) VALUES ( 
'te...@test.com', 12h30m30s);
INSERT INTO users.user_credentials_by_email (email, la_duration ) VALUES ( 
'te...@test.com', 12h30m30s250ms);
INSERT INTO users.user_credentials_by_email (email, la_duration ) VALUES ( 
'te...@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
----------------+----------------
 te...@test.com |            12h
 te...@test.com | 12h30m30s250ms
 te...@test.com |         12h30m
 te...@test.com |         12h30m
 te...@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
----------------+-----------------------------------------------------
 te...@test.com |                                               12.0h
 te...@test.com | 12.508402777777778h30.504166666666666m30.25s250.0ms
 te...@test.com |                                          12.5h30.0m
 te...@test.com |                                          12.5h30.0m
 te...@test.com |                       12.508333333333333h30.5m30.0s

(5 rows)



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

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

Reply via email to