Repository navigation
Don't check empty schema in SchemaProcessor - #108945
Conversation
|
Workflow [PR], commit [ebe72b8] Summary: ❌
AI ReviewSummaryThis PR makes Findings
Tests
Final VerdictStatus: Minimum required actions: scope the empty-schema skip to already-known manifest placeholders, and add focused regression coverage for both the accepted placeholder case and the unknown-schema case. |
|
|
||
| /// Databricks UniForm writes a degenerate placeholder schema (e.g. {"schema-id":0,"fields":[]}) | ||
| /// into manifest files, while the real schema with the same schema-id lives in metadata.json. | ||
| if (!schema_ptr->isArray(f_fields) || schema_ptr->getArray(f_fields)->size() == 0) |
There was a problem hiding this comment.
This skips any schema with missing or empty fields, but addIcebergTableSchema is the shared registration path for schemas read from metadata.json as well as manifest headers. The comment's safety condition only holds when this object is a Databricks manifest placeholder and the real schema for the same schema-id has already been registered from metadata. If an empty or malformed current schema comes from metadata, or a manifest placeholder is seen for an ID that was not registered yet, we now accept the ID without registering iceberg_table_schemas_by_ids / clickhouse_table_schemas_by_ids; later reads then fail with an unknown schema from getClickhouseTableSchemaById or lose schema-evolution/pruning info. Please keep the skip scoped to manifest placeholders with a known real schema, for example only return when iceberg_table_schemas_by_ids.contains(schema_id) is true, or move this guard to the manifest caller after metadata schemas have been loaded. Otherwise preserve the previous registration failure for invalid or unknown schemas.
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 5/6 (83.33%) · Uncovered code |
feae75b
Backport #108945 to 26.5: Don't check empty schema in SchemaProcessor
Backport #108945 to 26.3: Don't check empty schema in SchemaProcessor
Backport #108945 to 25.8: Don't check empty schema in SchemaProcessor
…-manifest-schema Don't check empty schema in SchemaProcessor
…is unknown" An Iceberg table whose schema has an empty `fields` array (valid per the spec; PyIceberg writes one for `create_table(schema=Schema())`) failed with `Schema with id 0 is unknown. (BAD_ARGUMENTS)`, although metadata.json defines the schema. `addIcebergTableSchema` returned early for every schema with an empty `fields` array. The skip was added in ClickHouse#108945 for the Databricks UniForm placeholder `{"schema-id":0,"fields":[]}` that is written into manifest headers while metadata.json holds the real schema 0; at that time the function did not know where a schema came from. So a metadata.json schema without fields was never registered, and the table structure lookup reported a known schema as unknown. Limit the skip to schemas from manifest files, and reject a schema without fields in `getClickHouseTableSchemaById` with EMPTY_LIST_OF_COLUMNS_PASSED, the code used when a table would get no columns. Every caller of that function builds a table or read structure (current schema, format version 1 `schema`, a snapshot schema selected with `iceberg_snapshot_id`, the sorting key, the REST catalog), so all of them get the clear error, and the schema inference fallback for an empty structure is never reached. An old schema without fields does not prevent reading the table with a later schema. Related: ClickHouse#130002 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Changelog category (leave one):
Version info
26.7.1.304(included in26.7and later)26.5.6.8,26.3.17.14,25.8.29.36