Skip to content

Conversation

Tishj
Copy link
Contributor

@Tishj Tishj commented May 12, 2025

This PR solves the issue that we don't traverse into LIST and MAP in the MultiFileReader, so schema evolutions to a STRUCT inside a LIST/MAP currently don't get applied properly.

Fixes https://github.com/duckdblabs/duckdb-internal/issues/4846

Now we properly traverse these types just like we already do for STRUCT.

@Tishj Tishj marked this pull request as ready for review May 12, 2025 15:13
@Tishj Tishj requested a review from Mytherin May 12, 2025 18:26
@Tishj
Copy link
Contributor Author

Tishj commented May 12, 2025

Follow up adding support for altering structs inside lists/maps is here: https://github.com/Tishj/duckdb/tree/list_alter_type

@@ -301,12 +452,16 @@ ColumnMapResult MapColumn(ClientContext &context, const MultiFileColumnDefinitio
// found a column mapping for this child - emplace it
column_mapping.emplace_back(global_child.name, std::move(child_map.column_map));
}
//! FIXME: the 'default_value' should only be used if the STRUCT's default value is not NULL
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this merges I'll work on adding support for the initial-default to iceberg and build a test for the table of point point.x and point.y from here: https://iceberg.apache.org/spec/#default-values while likely making changes to core here to support these scenarios.

@Mytherin Mytherin merged commit b7bf80a into duckdb:main May 13, 2025
51 checks passed
@Mytherin
Copy link
Collaborator

Thanks!

krlmlr added a commit to duckdb/duckdb-r that referenced this pull request May 18, 2025
Recurse into `MAP` and `LIST` with the `remap_struct` and the MFR ColumnMapper (duckdb/duckdb#17448)
krlmlr added a commit to duckdb/duckdb-r that referenced this pull request May 19, 2025
Recurse into `MAP` and `LIST` with the `remap_struct` and the MFR ColumnMapper (duckdb/duckdb#17448)
krlmlr added a commit to duckdb/duckdb-r that referenced this pull request May 19, 2025
Recurse into `MAP` and `LIST` with the `remap_struct` and the MFR ColumnMapper (duckdb/duckdb#17448)
Mytherin added a commit that referenced this pull request May 22, 2025
)

Follow-up fixes from #17448

Nested default values were ignored, which caused this code not to
correctly handle missing fields.

In addition, we can no longer directly emit the default value as the
result since the default value is no longer equivalent to the actual
value (e.g. the default value might be `{'list': {'k': NULL}}` when the
actual value should be `[{'k': NULL}]`.) We fix this by allowing
`remap_struct` to take `NULL` as remap target, in case there are zero
columns used from the source struct.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants