From fbd8a766c5453b2e015f0e9e6a1ee2d7557328d3 Mon Sep 17 00:00:00 2001 From: congqixia Date: Wed, 7 Jan 2026 10:09:25 +0800 Subject: [PATCH] fix: check field exists in column groups before reading from loon manifest (#46816) Related to #44956 Before reading field data from loon manifest, check if the field exists in column groups first. If the field does not exist, return an empty result instead of proceeding with the read operation. This is a workaround until loon natively supports returning null for non-existent fields. --------- Signed-off-by: Congqi Xia --- internal/core/src/storage/Util.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/internal/core/src/storage/Util.cpp b/internal/core/src/storage/Util.cpp index 785516d7af..3dc74b7022 100644 --- a/internal/core/src/storage/Util.cpp +++ b/internal/core/src/storage/Util.cpp @@ -1504,7 +1504,21 @@ GetFieldDatasFromManifest( std::optional element_type) { auto column_groups = GetColumnGroups(manifest_path, loon_ffi_properties); - // ReaderHandle reader_handler = 0; + // TODO remove manual check after loon support read null for non-exists field + bool field_exists = false; + const auto field_id_to_find = std::to_string(field_meta.field_id); + for (size_t i = 0; i < column_groups->size() && !field_exists; i++) { + auto column_group = column_groups->get_column_group(i); + for (const auto& column : column_group->columns) { + if (column == field_id_to_find) { + field_exists = true; + break; + } + } + } + if (!field_exists) { + return {}; + } std::string field_id_str = std::to_string(field_meta.field_id); std::vector needed_columns = {field_id_str};