mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
Related to #45543 When a field with a default value is added to a collection, the default value becomes null after compaction instead of retaining the expected default value. **Root Cause** The `appendValueAt` function in `internal/storage/arrow_util.go` incorrectly checked if the entire arrow.Array was nil before handling default values. This meant that default values were only applied when the array itself was nil, not when individual field values were null (which is the correct condition). **Changes** 1. **Early nil check**: Added a guard at the function entry to detect nil arrow.Array and return an error immediately, as this is an unexpected condition that should not occur during normal operation. 2. **Refactored default value handling**: Removed the per-type nil array checks and moved default value logic to handle individual null values within the array (when `IsNull(idx)` returns true). 3. **Applied to all types**: Updated the logic consistently across all builder types: - BooleanBuilder - Int8Builder, Int16Builder, Int32Builder, Int64Builder - Float32Builder - StringBuilder - BinaryBuilder (added default value support for internal $meta json) - ListBuilder (removed unnecessary nil check) --------- Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>