feat(core)!: support nested map expressions and import nested structs - #1062
Open
nielspardon wants to merge 1 commit into
Open
feat(core)!: support nested map expressions and import nested structs#1062nielspardon wants to merge 1 commit into
nielspardon wants to merge 1 commit into
Conversation
Proto `Expression.Nested` has three arms — struct, list and map — but only `list` round-tripped. `Expression.NestedMap` did not exist at all, so the `map` arm was unreachable, and `ProtoExpressionConverter.from(Nested)` handled only `case LIST`: a plan carrying a nested struct failed on import with `UnsupportedOperationException: Unimplemented nested type: STRUCT`, even though the POJO to proto direction emitted one. (`VirtualTableScan` rows were unaffected — they use the separate `from(Nested.Struct)` overload.) Adds the `NestedMap` POJO with the usual visitor and converter wiring, and imports all three nested kinds on the way back from proto. `NestedMap` preserves key-value order, so proto `key_values` ordering survives a round trip, and its `@Value.Check` rejects an empty map and heterogeneous key or value types with `IllegalArgumentException`. Isthmus still cannot convert nested structs or maps to and from Calcite; that follows separately. Part of #375 BREAKING CHANGE: `ExpressionVisitor` gains `visit(Expression.NestedMap)`. Direct implementors must add it; implementors extending `AbstractExpressionVisitor` inherit the `visitFallback` default and need no change.
nielspardon
marked this pull request as draft
August 5, 2026 12:11
nielspardon
marked this pull request as ready for review
August 6, 2026 07:18
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.
Proto
Expression.Nestedhas three arms — struct, list and map — but onlylistround-tripped.Expression.NestedMapdid not exist at all, so themaparm was unreachable, andProtoExpressionConverter.from(Nested)handled onlycase LIST: a plan carrying a nested struct failed on import withUnsupportedOperationException: Unimplemented nested type: STRUCT, even though the POJO to proto direction emitted one. (VirtualTableScanrows were unaffected — they use the separatefrom(Nested.Struct)overload.)This adds the
NestedMapPOJO with the usual visitor and converter wiring, and imports all three nested kinds on the way back from proto.Two details worth calling out:
Nested.Mapis a repeatedkey_values, soNestedMapkeeps insertion order — the Immutables-generated map isLinkedHashMap-backed — and both converters preserve it. Without that, a round trip could reorder the pairs.@Value.Checkthrows rather than asserts.NestedList, written earlier, usesassertfor the same invariants, which does not run outside a-eaJVM.NestedMaprejects an empty map (pointing atExpressionCreator.emptyMap) and heterogeneous key or value types withIllegalArgumentException, matching the direction of Replaceassert-based validation with real exceptions in:coreand:isthmus#1047.Isthmus still cannot convert nested structs or maps to and from Calcite; that follows in a stacked PR, which closes #375.
Part of #375
BREAKING CHANGE:
ExpressionVisitorgainsvisit(Expression.NestedMap). Direct implementors must add it; implementors extendingAbstractExpressionVisitorinherit thevisitFallbackdefault and need no change.🤖 Generated with AI