Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
None
-
Correctness
-
Low
-
Normal
-
Adhoc Test
-
All
-
None
-
Description
Description:
"SELECT JSON ..." and "toJson(...)" on Cassandra 4.1.4 produces different date than "SELECT ..." for some timestamp type values.
Steps to reproduce:
$ sudo docker pull cassandra:4.1.4 $ sudo docker create --name cass cassandra:4.1.4 $ sudo docker start cass $ # wait for the Cassandra instance becomes ready $ sudo docker exec -ti cass cqlsh Connected to Test Cluster at 127.0.0.1:9042 [cqlsh 6.1.0 | Cassandra 4.1.4 | CQL spec 3.4.6 | Native protocol v5] Use HELP for help. cqlsh> create keyspace test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}; cqlsh> use test; cqlsh:test> create table tbl (id int, ts timestamp, primary key (id)); cqlsh:test> insert into tbl (id, ts) values (1, -13767019200000); cqlsh:test> select tounixtimestamp(ts), ts, tojson(ts) from tbl where id=1; system.tounixtimestamp(ts) | ts | system.tojson(ts) ----------------------------+---------------------------------+---------------------------- -13767019200000 | 1533-09-28 12:00:00.000000+0000 | "1533-09-18 12:00:00.000Z" (1 rows) cqlsh:test> select json * from tbl where id=1; [json] --------------------------------------------- {"id": 1, "ts": "1533-09-18 12:00:00.000Z"} (1 rows)
Expected behaviour:
The "select ts", "select tojson(ts)" and "select json *" should all produce the same date.
Actual behaviour:
The "select ts" produced the "1533-09-28" date but the "select tojson(ts)" and "select json *" produced the "1533-09-18" date.