Skip to content

Prototype MAP and MULTISET JSON batch boundaries - #202

Draft
jordepic wants to merge 1 commit into
extend-json-calc-nested-91from
extend-json-map-91
Draft

jordepic wants to merge 1 commit into
extend-json-calc-nested-91from
extend-json-map-91

Conversation

@jordepic

@jordepic jordepic commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator

Prototype MAP and MULTISET inputs/results through the existing generated JSON Calc batch bridge. Keys/elements must be declared non-null; nullable values and nested arrays/rows remain supported. Borrowed MapData stays within the imported batch lifetime, results own their Arrow buffers, and JNI remains one call per batch.

Stacked on #199. This is a draft investigation for #91, not a performance improvement, and should not be automatically merged merely when CI is green.

Validation: 70 focused SQL/bridge/comparison cases and 32 unchanged upstream Calc cases passed, including three actual native-execution contracts. A 5,003-row case verifies filtering, nested map ownership and native row counters across batches. Nullable map keys/multiset elements retain explicit fallback. Integer-keyed maps can cross the boundary, but Flink's unsupported JSON serialization of those maps is not claimed.

Release+mimalloc benchmarks (2M rows, 2 warmups, 5 interleaved trials, both transposes) are slower than Flink: 0.652x for MAP serialization and 0.466x for MAP-bearing results. A JSON filter followed by grouped COUNT was also slower at 0.705x (native 4.774s vs Flink 3.365s). Raw trials are committed. Hold this prototype pending a demonstrated useful composition or further performance work.

CI is cancelled while this draft is held for the measured performance regressions. It must be rerun in full before any ready/merge decision; the required checks remain unchanged.

Reuse borrowed Flink MapData inside the existing import/evaluate/export lifetime, recursively admitting declared non-null MAP keys and MULTISET elements while preserving nullable values. Compare nested collection contents in the parity harness instead of Java array identities, without losing changelog kinds. No additional JSON parser or per-row JNI call is introduced.

70 focused SQL, bridge and comparison cases pass, including 5003 input rows across filtered batches; all 32 unchanged upstream Calc cases pass with three actual native execution contracts. Release+mimalloc 2M-row measurements are slower than Flink: 0.652x map serialization, 0.466x nested output and 0.705x JSON-filter/grouped-count composition, including both transposes. Preserve every measured trial and keep this as a draft coverage prototype pending a stronger performance case; do not claim an optimization. Advances investigation for #91.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant