You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Artem Golovko (Jira)" <ji...@apache.org> on 2025/02/05 19:08:00 UTC

[jira] [Created] (CASSANDRA-20295) [Cassandra 5.x] Min/Max aggregation not working

Artem Golovko created CASSANDRA-20295:
-----------------------------------------

             Summary: [Cassandra 5.x] Min/Max aggregation not working
                 Key: CASSANDRA-20295
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-20295
             Project: Apache Cassandra
          Issue Type: Bug
            Reporter: Artem Golovko


*Cassandra version*

5.0.3

docker run --name cassandra -d cassandra:5

docker exec -it cassandra cqlsh

 

{*}Data schema{*}{*}{*}
{code:java}
CREATE KEYSPACE IF NOT EXISTS test WITH replication = { 'class': 'SimpleStrategy', 'replication_factor': 1 } AND durable_writes = true; 

USE test;

CREATE TABLE data(
  sensor_id text,
  time timestamp,
  value double,
  PRIMARY KEY (sensor_id, time)
) WITH CLUSTERING ORDER BY (time DESC)
  AND compaction = {'class': 'TimeWindowCompactionStrategy' }; 

INSERT INTO data (sensor_id, time, value) VALUES ('s1', 0,    1);
INSERT INTO data (sensor_id, time, value) VALUES ('s1', 1000, 2);{code}
 

*Actual result*
{code:java}
SELECT min(time), max(time) FROM data WHERE sensor_id = 's1'; 

system.min(time)                | system.max(time)
---------------------------------+---------------------------------
 1970-01-01 00:00:01.000000+0000 | 1970-01-01 00:00:00.000000+0000(1 rows){code}
 

{*}Expected result{*}{*}{*}

On cassandra 4 (tested with 4.1.8) everything is working fine
{code:java}
SELECT min(time), max(time) FROM data WHERE sensor_id = 's1'; 

system.min(time)                | system.max(time)
---------------------------------+---------------------------------
 1970-01-01 00:00:00.000000+0000 | 1970-01-01 00:00:01.000000+0000(1 rows){code}
*Note*

If we'll change clustering order from DESC to ASC then problem disappear ** 



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

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