From 8abfd8229bbd2b5a8429d82dd6b1c4f346cc7fc5 Mon Sep 17 00:00:00 2001 From: usamoi Date: Thu, 5 Sep 2024 10:11:08 +0800 Subject: [PATCH] fix: set correct svecf32 header while creating SVecf32Output (#590) Signed-off-by: usamoi --- src/datatype/memory_svecf32.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/datatype/memory_svecf32.rs b/src/datatype/memory_svecf32.rs index a560d243e..a4d49d074 100644 --- a/src/datatype/memory_svecf32.rs +++ b/src/datatype/memory_svecf32.rs @@ -98,10 +98,10 @@ impl SVecf32Output { let ptr = pgrx::pg_sys::palloc(layout.size()) as *mut SVecf32Header; ptr.cast::().add(layout.size() - 8).write_bytes(0, 8); std::ptr::addr_of_mut!((*ptr).varlena).write(SVecf32Header::varlena(layout.size())); + std::ptr::addr_of_mut!((*ptr).reserved).write(0); + std::ptr::addr_of_mut!((*ptr).magic).write(HEADER_MAGIC); std::ptr::addr_of_mut!((*ptr).dims).write(vector.dims()); - std::ptr::addr_of_mut!((*ptr).magic).write(2); std::ptr::addr_of_mut!((*ptr).len).write(vector.len()); - std::ptr::addr_of_mut!((*ptr).reserved).write(HEADER_MAGIC); let mut data_ptr = (*ptr).phantom.as_mut_ptr().cast::(); std::ptr::copy_nonoverlapping( vector.indexes().as_ptr(),