Repository navigation
fix(core)!: correct SUM and SUM0 helper results - #1262
Conversation
2026afd to
25a08dc
Compare
25a08dc to
96e7dc2
Compare
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 52 minutes. View limit detailsLimit details: You’ve used all 2 included reviews currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
nielspardon
left a comment
There was a problem hiding this comment.
The builder change matches the spec, but floating-point sum0 now breaks isthmus SQL output — see the inline comment. Everything else is minor and can follow once that's settled.
Select sum0 in both overloads and derive arithmetic aggregate output types from the configured function declarations. Cover floating-point SUM0 SQL generation with the upstream aggregate type inference fix. BREAKING CHANGE: SUM widens narrow integer and floating-point results according to the spec. Floating-point SUM0 returns fp64, and sum0(Rel,int) now emits sum0. Custom return declarations are honored by these helpers.
96e7dc2 to
7ff4e25
Compare
|
Picking up the upstream fix resolved the SUM0 conversion issue. I added floating-point coverage for both helper overloads through Calcite, PostgreSQL, and Spark SQL conversion, checking that they retain COALESCE(SUM(...), 0). |
nielspardon
left a comment
There was a problem hiding this comment.
Thanks — the SUM0 fix via #1347 works. Please extend the BREAKING CHANGE: footer, since it's the only part of the body that reaches the release notes. It should say three things: all five helpers now take their output type from the supplied catalog (the commit footer said this; the PR body moved it under Downsides), sum0(Rel, int) changes from a nullable sum to a required sum0, and the Spark module has no sum0 mapping, so builder plans using that overload no longer convert to Spark.
|
Thanks for the detailed pass. I added explicit min/max/avg function-name assertions and routed return-type evaluation through |
The field overload of sum0 currently emits sum, so an empty input returns null rather than zero. SUM also retains narrow input types instead of using the declared wider result, and floating-point SUM0 incorrectly declares i64.
For an i32 input, these helpers must emit nullable i64 for SUM and the sum0 function with required i64 for SUM0:
Delegate the field overload to sum0 and derive the output type in the shared arithmetic helper from its function declaration. This follows spec v0.102.0: integer sums use i64, floating-point sums use fp64, SUM is nullable, and SUM0 is required. Standard MIN/MAX/AVG results retain their existing types.
BREAKING CHANGE: All five helpers (min, max, avg, sum, and sum0) now derive output types from the supplied extension catalog, so custom catalog return declarations can change the result schema. With the default catalog, SUM over i8/i16/i32 or fp32 now reports the wider type, and floating-point SUM0 reports fp64 instead of i64. Callers that depend on the previous output schemas must use the returned types. The sum0(Rel, int) overload now emits sum0 with its required result type instead of sum with a nullable result. The Spark module currently lacks a sum0 mapping, so plans using this overload cannot be converted to Spark until that mapping is added.