Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for transpiling PartiQL struct types into multiple SQL dialects, including struct field navigation and struct construction, and expands golden test coverage for these cases.
Changes:
- Add new
struct.sqlinput fixture plus expected outputs for PartiQL, Trino, Spark, and Redshift. - Update Spark struct construction to use
NAMED_STRUCT, and adjust Spark EXCLUDE golden outputs accordingly. - Extend Trino/Redshift rewrites to handle constructed structs (and, for Redshift, to hard-fail unsupported constructed-struct field access).
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/resources/outputs/trino/basics/struct.sql | New Trino golden outputs covering struct selection, navigation, wildcard expansion, and construction. |
| src/test/resources/outputs/spark/basics/struct.sql | New Spark golden outputs using NAMED_STRUCT for struct construction and field access. |
| src/test/resources/outputs/spark/basics/exclude.sql | Updates Spark EXCLUDE golden outputs to use NAMED_STRUCT instead of STRUCT(... AS ...). |
| src/test/resources/outputs/redshift/basics/struct.sql | New Redshift golden outputs using OBJECT(...) and documenting unsupported constructed-struct field access. |
| src/test/resources/outputs/partiql/basics/struct.sql | New PartiQL golden outputs for struct behaviors (baseline dialect). |
| src/test/resources/inputs/basics/struct.sql | New input fixture covering struct cases (navigation, dot-star, construction, filtering, join, subquery). |
| src/test/resources/catalogs/default/T_ALL_TYPES.ion | Updates catalog schema to include col_struct_simple and col_struct_nested with nested struct fields. |
| src/main/kotlin/org/partiql/scribe/targets/trino/utils/TrinoExcludeUtils.kt | Extends Trino ROW reconstruction to also handle RexStruct operands; adjusts UNKNOWN type handling. |
| src/main/kotlin/org/partiql/scribe/targets/trino/TrinoRewriter.kt | Wraps constructed structs in CAST-to-ROW when used in path navigation; rewrites nested RexStruct fields. |
| src/main/kotlin/org/partiql/scribe/targets/trino/TrinoAstToSql.kt | Adds a defensive error path for ExprStruct reaching AST-to-SQL conversion. |
| src/main/kotlin/org/partiql/scribe/targets/spark/SparkAstToSql.kt | Switches struct construction emission to NAMED_STRUCT and adds struct-field emission visitor. |
| src/main/kotlin/org/partiql/scribe/targets/redshift/RedshiftRewriter.kt | Throws a targeted error when accessing fields on constructed structs (unsupported in Redshift). |
| api/Scribe.api | Captures new public API surface from added visitor overrides. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
XuechunHHH
reviewed
Apr 16, 2026
johnedquinn
reviewed
Apr 16, 2026
johnedquinn
reviewed
Apr 16, 2026
johnedquinn
reviewed
Apr 16, 2026
johnedquinn
reviewed
Apr 16, 2026
Member
johnedquinn
left a comment
There was a problem hiding this comment.
Overall looks good. Minor comments.
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.
Issue #, if available:
None
Description of changes:
Adds support for transpiling PartiQL struct types into multiple SQL dialects, including struct field navigation and struct construction, and expands golden test coverage for these cases.
Changes:
Add new struct.sql input fixture plus expected outputs for PartiQL, Trino, Spark, and Redshift.
Update Spark struct construction to use NAMED_STRUCT, and adjust Spark EXCLUDE golden outputs accordingly.
Extend Trino/Redshift rewrites to handle constructed structs (and, for Redshift, to hard-fail unsupported constructed-struct field access).
Each Tests are manually tested on each sql engine.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.