@@ -172,27 +172,7 @@ Status ExternalColMetaUtil::write_external_column_meta(
172172 // 2) write pointers via proto fields
173173 footer->set_col_meta_region_start (meta_region_start);
174174
175- // 3) clear inline columns to enable true on-demand meta loading
176- // Note: footer->columns has already been pruned to only Top Level Columns in externalize_from_footer
177- // But for full externalization, we might want to clear them all or keep only necessary info?
178- // The original logic was footer->clear_columns().
179- // If we clear columns, the Reader needs to know how to reconstruct the schema.
180- // Currently, SegmentFooterPB.columns is used as the schema source if present.
181- // If we clear it, Reader must rely on External Meta.
182- // However, the Reader typically reads footer first. If columns is empty, it assumes V3 and reads external.
183- // So yes, we should clear it.
184- // But wait, in externalize_from_footer we carefully put Top Level columns back into footer->columns.
185- // Why? Because in previous logic, we might want to keep roots in footer?
186- // The previous logic: "replace Footer.columns with only the kept top-level columns".
187- // BUT then `write_external_column_meta` calls `footer->clear_columns()` at the end!
188- // So `footer->columns` will be empty anyway.
189- // The only reason to reconstruct `footer->columns` in `externalize_from_footer` is if `write_external_column_meta` logic depended on it.
190- // In my updated `write_external_column_meta`, I iterate over `all_metas` which is returned by `externalize_from_footer`.
191- // So I don't strictly need `footer->columns` to be correct in between.
192- // However, strictly following protocol: `externalize_from_footer` modifies footer to reflect "logical" columns (Top Level).
193- // And then `write_external_column_meta` finalizes it by clearing them and setting pointers.
194-
195- footer->clear_columns ();
175+ // Note: footer->columns has already been pruned in externalize_from_footer
196176 return Status::OK ();
197177}
198178
0 commit comments