Repository navigation
feat: Fix tpch SQL issues - #29269
Merged
Merged
feat: Fix tpch SQL issues #29269
Conversation
- `INTERVAL '3' MONTH` / `INTERVAL 3 MONTH` (leading unit) intervals - `YEAR(x)`, `MONTH(x)`, `DAY(x)`, `HOUR(x)`, ... date part functions - `LIKE`/`ILIKE`/`IN`/... predicates inside `JOIN ... ON` - bare ISO date in `TIMESTAMP`/`DATETIME` typed literals - integer literals compared for equality against a String expression (`substring(x, 1, 2) IN (13, 31)`) are compared as strings - literal-only arithmetic (`.06 + 0.01`) is folded exactly so it compares correctly against Decimal columns, matching decimal SQL semantics Closes #29169 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lj7JbtU82rEjCBvQ98absi
…e path Right-table columns are renamed at the SQL level before parsing, so a predicate may reference the same clashing column on both sides. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lj7JbtU82rEjCBvQ98absi
Contributor
|
The uncompressed lib size after this PR is 55.5910 MB (at |
Constant WHERE conditions are now evaluated through the expression visitor instead of comparing raw SQL literals, and the OR-chain IN fallback shares the same coercion as binary comparisons. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lj7JbtU82rEjCBvQ98absi
Window, aggregate and selector expressions name no column but still read the input; the constant shortcut now checks the parsed expression. Equi-join keys get the same string/integer literal coercion as `=`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lj7JbtU82rEjCBvQ98absi
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lj7JbtU82rEjCBvQ98absi
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lj7JbtU82rEjCBvQ98absi
ritchie46
marked this pull request as ready for review
September 12, 2026 18:26
ritchie46
requested review from
MarcoGorelli,
alexander-beedie,
c-peters and
orlp
as code owners
September 12, 2026 18:26
…hmetic `polars_compute::decimal::exact` owns checked fixed-point scalar arithmetic on `(mantissa, scale)` pairs; `polars_sql::literal_folding` owns which SQL forms qualify, reading the literal spelling, and the single conversion to Float64.
…translation A WHERE condition is always translated to a filter; the planner folds a constant one. A column-free JOIN ON condition becomes a boolean join key against `true` whenever the planner proves it input-independent, so true, false and NULL conditions all defer to normal execution for every join type. An inner join on the same non-null constant key on both sides lowers to a cross join.
… lazy predicate path A literal on the left of `IN` is compared as an OR-chain, which the planner folds; a constant WHERE condition is cast to boolean lazily; the inner join to cross join rewrite only applies to unvalidated joins.
An `ARRAY[...]` literal is one list value, not a one-row Series, so the planner classifies expressions over it as input-independent.
ritchie46
commented
Sep 13, 2026
|
|
||
| /// Returns `x * 10^e`, or None on overflow; `e` is not bounded by `DEC128_MAX_PREC`. | ||
| #[inline] | ||
| pub fn i128_mul_pow10(x: i128, mut e: usize) -> Option<i128> { |
Member
Author
There was a problem hiding this comment.
This is to constant fold decimal literals before we convert to float.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #29269 +/- ##
==========================================
+ Coverage 81.71% 81.75% +0.04%
==========================================
Files 1914 1916 +2
Lines 273645 274104 +459
Branches 3113 3113
==========================================
+ Hits 223612 224098 +486
+ Misses 49246 49220 -26
+ Partials 787 786 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes: #29169