Add support for changing row type in Iceberg#15808
Conversation
Additionally, use SELECT instead of VALUES to handle row type correctly.
7319d57 to
8d5a7fd
Compare
8d5a7fd to
5ea6aa0
Compare
alexjo2144
left a comment
There was a problem hiding this comment.
All nitpicky things, looks good to me
There was a problem hiding this comment.
It doesn't matter, functionality-wise, but can we make these checks symmetrical so that they both check the source and new type?
| if (newType.isPrimitiveType()) { | |
| return schema.updateColumn(name, newType.asPrimitiveType()); | |
| } | |
| if (sourceType instanceof StructType sourceRowType && newType instanceof StructType newRowType) { | |
| if (sourceType.isPrimitiveTyple() && newType.isPrimitiveType()) { | |
| return schema.updateColumn(name, newType.asPrimitiveType()); | |
| } | |
| if (sourceType instanceof StructType sourceRowType && newType instanceof StructType newRowType) { |
There was a problem hiding this comment.
Could move this outside of the loop, right?
There was a problem hiding this comment.
Nit: I see that returning the UpdateSchema makes calling commit easier above, but personally find this easier to read.
| private static UpdateSchema buildUpdateSchema(String name, Type sourceType, Type newType, UpdateSchema schema) | |
| private static void buildUpdateSchema(String name, Type sourceType, Type newType, UpdateSchema schemaUpdate) |
There was a problem hiding this comment.
This will have duplicates for fields in both old and new type. Also doesn't matter functionality wise but would be nice not to have to iterate over them twice.
5ea6aa0 to
3096374
Compare
|
|
| // TODO https://github.com/trinodb/trino/issues/15822 The connector returns incorrect NULL when a field in row type doesn't exist in Parquet files | ||
| return Optional.of(setup.withNewValueLiteral("NULL")); |
There was a problem hiding this comment.
Single-field row types aren't very common.
Let's make sure we have a test for renaming some, but not all fields in a row (eg have a row with two fields).
(We can keep this one too)
Description
Add support for changing fields in
rowtype in Iceberg. The supported operations:Release notes
(x) Release notes are required, with the following suggested text if this PR isn't merged in 406: