feat: support expression in limit clause #19834
+192
−21
Merged
Task list completed / task-list-completed
Started
2024-12-27 11:44:28
ago
0 / 1 tasks completed (+7 optional)
1 task still to be completed (+7 optional)
Details
Required Tasks
Task | Status |
---|---|
I have written necessary rustdoc comments. | Incomplete |
This validation logic is better placed in binder, and BoundQuery::limit remains an Option<u64> . Planner is in charge of transforming SQL into a plan graph. |
Incomplete |
We can do cast first and then try_fold_const , rather than using is_const and fold_const separately. |
Incomplete |
The allowed casts in PostgreSQL is assign rather than explicit . (int requires implicit , decimal requires assign , jsonb requires explicit . I tested in PostgreSQL and LIMIT '1'::jsonb is not allowed.) |
Incomplete |
When the evaluated output is None , which means SQL NULL, PostgreSQL treats it as no limit. Let's add a test case for this. |
Incomplete |
Test error cases: wrong type, not const, eval error, negative | Incomplete |
Wrong type already handled as cast_assign error above. |
Incomplete |
Not const corresponds to None . The test case can be select 1 limit generate_series(1, 2); |
Incomplete |
Eval error corresponds to Some(Err(_)) . The test case can be select 1 limit 2/0; |
Incomplete |
Optional Tasks
Task | Status |
---|---|
I have added necessary unit tests and integration tests. | Incomplete |
I have added test labels as necessary. | Incomplete |
I have added fuzzing tests or opened an issue to track them. | Incomplete |
My PR contains breaking changes. | Incomplete |
My PR changes performance-critical code, so I will run (micro) benchmarks and present the results. | Incomplete |
My PR contains critical fixes that are necessary to be merged into the latest release. | Incomplete |
My PR needs documentation updates. | Incomplete |
Loading