pub(crate) fn build_table_meta_from_column_metadatas(
table_id: TableId,
table_ref: TableReference<'_>,
table_meta: &TableMeta,
name_to_ids: Option<HashMap<String, u32>>,
column_metadata: &[ColumnMetadata],
) -> Result<TableMeta>Expand description
Builds a TableMeta from the provided [ColumnMetadata]s, preserving schema column order
from table_meta and taking the primary key order from the input tags.
The input [ColumnMetadata]s determine which columns currently exist in region metadata:
- Columns present in
table_metabut missing fromcolumn_metadataare dropped. - Columns present in both retain the column order from
table_meta.schema. - Columns present only in
column_metadataare appended. - Primary key order follows the tag columns in
column_metadata, which the physical-table reconcile paths feed in the regions’ key order (table_meta.primary_key_indicesonly determines which columns must remain tags). The logical-table reconcile path feeds columns in column-position order and relies on a subsequentsort_columns()call.
Returns an error if:
- Any column is missing in the
name_to_ids(ifname_to_idsis provided). - The column id in table metadata is not the same as the column id in the column metadata.(if
name_to_idsis provided) - The table index is missing in the column metadata.
- Any primary key column of
table_metais not [SemanticType::Tag] incolumn_metadata. - The primary key or partition key columns are missing in the column metadata.