IGNITE-28844 Calcite. Improve type checking in LIMIT / OFFSET clauses#13311
IGNITE-28844 Calcite. Improve type checking in LIMIT / OFFSET clauses#13311zstan wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR (“IGNITE-28844 Calcite. Improve type checking in LIMIT / OFFSET clauses”) tightens validation for LIMIT / OFFSET values (including dynamic parameters) and aligns execution nodes to accept long-based fetch/offset values, with accompanying tests.
Changes:
- Added stricter validator checks for
LIMIT/OFFSETliterals and dynamic parameters (numeric-only, long-range, non-negative). - Introduced a planner-test helper (
StatementChecker) and added new planner/integration tests for dynamic parameters inLIMIT/OFFSET. - Updated execution nodes (
LimitNode,SortNode) and implementor wiring to uselongfetch/offset values and centralize “illegal fetch/offset” error reporting.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| modules/calcite/src/test/sql/order/test_limit.test | Adds negative SQL cases for invalid FETCH FIRST / LIMIT values and expressions. |
| modules/calcite/src/test/java/org/apache/ignite/testsuites/PlannerTestSuite.java | Registers the new dynamic-parameters planner test in the suite. |
| modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/StatementChecker.java | Adds a new test helper for validating statements/plans (currently has critical correctness gaps). |
| modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/DynamicParametersPlannerTest.java | Adds planner-level tests for dynamic parameter typing/range checks in LIMIT/OFFSET. |
| modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AbstractPlannerTest.java | Adds checkStatement(...) helper and PlanChecker implementation to drive planner validation in tests. |
| modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/DynamicParametersIntegrationTest.java | Adds integration coverage for LIMIT ? with integer and BigDecimal parameters. |
| modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/LimitExecutionTest.java | Updates execution tests to new LimitNode/SortNode APIs (currently inconsistent for “unlimited” fetch). |
| modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/IgniteResource.java | Adds new validator error messages for illegal fetch/offset and dynamic parameter type mismatch. |
| modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/IgniteSqlValidator.java | Implements the new fetch/offset validation logic for literals and dynamic params. |
| modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SortNode.java | Switches limited-sort parameter types to long and adjusts bounded/unbounded buffer selection. |
| modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/LimitNode.java | Switches limit/offset parameter types to long and updates request/push logic for new semantics. |
| modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/AbstractNode.java | Introduces a shared NOT_WAITING sentinel constant. |
| modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/LogicalRelImplementor.java | Wires runtime fetch/offset evaluation and validation into LimitNode / SortNode construction. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * .ok(); | ||
| * </pre> | ||
| */ | ||
| public class StatementChecker { |
There was a problem hiding this comment.
this checker will be used not only for dyn params checks and will be extended in future
|
Hi, regarding https://issues.apache.org/jira/browse/CALCITE-7624, I implemented support for BigDecimal for the OFFSET/FETCH and LIMIT in #13375. |
No description provided.