[ 
https://issues.apache.org/jira/browse/CASSANDRA-20295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17924387#comment-17924387
 ] 

Stefan Miklosovic commented on CASSANDRA-20295:
-----------------------------------------------

I have drastically simplified that thanks to hint of [~dcapwell] .

> Fix  Min/Max aggregation function on reversed types
> ---------------------------------------------------
>
>                 Key: CASSANDRA-20295
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-20295
>             Project: Apache Cassandra
>          Issue Type: Bug
>          Components: Legacy/Core, Legacy/Local Write-Read Paths
>            Reporter: Artem Golovko
>            Assignee: Stefan Miklosovic
>            Priority: Normal
>             Fix For: 5.0.x, 5.x
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> *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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to