tkalkirill commented on code in PR #13375:
URL: https://github.com/apache/ignite/pull/13375#discussion_r3729943868
##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/LimitOffsetIntegrationTest.java:
##########
@@ -121,10 +128,62 @@ public void testInvalidLimitOffset() {
assertThrows("SELECT * FROM TEST_REPL OFFSET -1 ROWS",
IgniteSQLException.class, null);
+ assertThrows("SELECT * FROM TEST_REPL OFFSET -1.5 ROWS",
+ IgniteSQLException.class, null);
+
assertThrows("SELECT * FROM TEST_REPL OFFSET 2+1 ROWS",
IgniteSQLException.class, null);
}
+ /** */
+ @Test
+ public void testFractionalLimitOffset() throws Exception {
+ fillCache(cacheRepl, 4);
+
+ assertQuery("SELECT id FROM TEST_REPL ORDER BY id LIMIT
1.2").returns(0).check();
+ assertQuery("SELECT id FROM TEST_REPL ORDER BY id LIMIT
1.5").returns(0).returns(1).check();
+
+ assertQuery("SELECT id FROM TEST_REPL ORDER BY id FETCH FIRST 1.3 ROWS
ONLY").returns(0).check();
+ assertQuery("SELECT id FROM TEST_REPL ORDER BY id FETCH FIRST 1.6 ROWS
ONLY").returns(0).returns(1).check();
+
+ assertQuery("SELECT id FROM TEST_REPL ORDER BY id OFFSET 2.3
ROWS").returns(2).returns(3).check();
+ assertQuery("SELECT id FROM TEST_REPL ORDER BY id OFFSET 2.6
ROWS").returns(3).check();
+ }
+
+ /** */
+ @Test
+ public void testFetchOffsetRoundingPolicy() throws Exception {
+ fillCache(cacheRepl, 4);
+
+ FetchOffsetRoundingPolicy floorPlc = value -> value.setScale(0,
RoundingMode.FLOOR);
Review Comment:
I don’t think this needs to become a public Ignite setting. Rounding
semantics may depend on the required SQL compatibility mode, so having one
hardcoded behavior for every use case is unnecessarily restrictive.
This policy is an internal Calcite extension point intended for advanced
integrations, not a part of the public Ignite API. The default behavior is
still used everywhere unless a custom policy is explicitly provided. Keeping it
internal also allows us to evolve or replace the mechanism later without
introducing a public API compatibility burden.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]