Repository navigation
feat(datafusion): extend aggregate, JSON and SQL dialect compatibility - #1304
Merged
Merged
Conversation
…les by responsibility
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.
Purpose
Closes #1303.
Common aggregate spellings, JSON output expressions, custom LIKE escapes and several SQL dialect entry points currently fail during SQLContext planning or execution. This change executes those patterns through existing DataFusion/Paimon primitives while preserving NULL, ordering, name-resolution and schema-evolution contracts.
Brief change log
extended_describeand expression lowering inexpression_compat. Selection aggregates adapt native first_value state and grouped accumulation while evaluating each value/key once.Tests
TZ=UTC RUST_MIN_STACK=16777216 CARGO_BUILD_JOBS=3 cargo test --locked -p paimon-datafusion --all-targets -- --test-threads=4with Rust 1.95.0.--no-deps -- -D warnings, formatting and diff checks.API and Format
Adds SQL names and syntax. New bare compatibility names follow built-in precedence; explicitly registered session functions and qualified catalog calls retain their precedence. Extended Paimon DESCRIBE returns comment/metadata rows, while native and temporary objects retain their existing description behavior. No storage-format, dependency or Rust public API changes.
The documented initial scope uses native fixed-precision HLL, two-argument selection aggregates and scalar MODIFY types. Unsupported precision requests, selection window/DISTINCT modifiers, LISTAGG overflow clauses and nested MODIFY targets fail explicitly. Existing nullability-change policy remains in force.
Design scope
Paimon metadata, Variant conversion and schema changes stay in the integration layer. General expressions reuse native aggregators, Arrow values/timezones and existing Variant decoding, retaining native aggregate state layouts and existing storage contracts.
These are documented SQLContext compatibility subsets. Two-argument date_diff uses end/start date subtraction; the unit/start/end form has explicit UTC/calendar rules. JSON output retains nested NULLs and Arrow temporal formatting and does not implement Spark JSON options. CONV accepts source bases 2 through 36, with negative destination bases for signed output. Native HLL precision and explicit DST-ambiguity behavior are retained.
DataFusion 54's separate Spark package already covers some overlapping names, including collect_list and two-argument date_diff. This PR keeps small native adapters without adding that dependency or registering its full set of overriding functions; future expansion should evaluate selective upstream reuse first. Full Spark/MySQL/Trino emulation is outside this change.
Documentation
Updated
docs/src/sql.mdwith syntax, supported inputs, NULL/error behavior, timezone/encoding rules, precedence and compatibility limits.