You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Nadav Har'El (Jira)" <ji...@apache.org> on 2026/10/09 13:16:00 UTC
[jira] [Created] (CASSANDRA-21739) floor() in GROUP BY reports invalid arguments as a ReadFailure instead of an InvalidRequest
Nadav Har'El created CASSANDRA-21739:
----------------------------------------
Summary: floor() in GROUP BY reports invalid arguments as a ReadFailure instead of an InvalidRequest
Key: CASSANDRA-21739
URL: https://issues.apache.org/jira/browse/CASSANDRA-21739
Project: Apache Cassandra
Issue Type: Bug
Reporter: Nadav Har'El
When floor() is used in a GROUP BY clause with an invalid duration or starting time, the request fails with a ReadFailure ("Operation failed - received 0 responses and 1 failures: UNKNOWN from ...") instead of an InvalidRequest error. The InvalidRequestException is thrown on the replica while reading, and appears only in the server's log:
{code:sql}
CREATE TABLE ks.t (pk int, time timestamp, v int, PRIMARY KEY (pk, time));
INSERT INTO ks.t (pk, time, v) VALUES (1, '2016-09-27 16:10:00 UTC', 1);
SELECT pk, floor(time, 10us), min(v) FROM ks.t GROUP BY pk, floor(time, 10us);
{code}
{noformat}
ReadFailure: Error from server: code=1300 [Replica(s) failed to execute read] message="Operation failed - received 0 responses and 1 failures: UNKNOWN from /127.0.0.1:7000"
{noformat}
The server log shows:
{noformat}
java.lang.RuntimeException: org.apache.cassandra.exceptions.InvalidRequestException: The floor cannot be computed for the 10us duration as precision is below 1 millisecond
{noformat}
The same happens for the other argument checks of floor() in GROUP BY: a negative duration, a starting time later than the value, a duration below 1 day for date values, and a duration of a day or more for time values. In contrast, the same floor() call outside GROUP BY (e.g. SELECT floor(time, 10us) FROM ks.t WHERE pk = 1) correctly fails with InvalidRequest.
Reproduced on Cassandra 5.0.9 and 6.0-alpha2. SelectGroupByTest (testGroupByTimeRanges*WithoutPaging) checks these errors with assertInvalidMessage(), but doesn't notice the problem, because CQLTester's execute() runs the query internally, where the InvalidRequestException surfaces unwrapped.
--
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