From ffc3bcacc8b34e5e53b78977f58b2d9113c91635 Mon Sep 17 00:00:00 2001 From: shaoting-huang Date: Tue, 7 Jan 2025 16:33:06 +0800 Subject: [PATCH] packed writer writes column offsets to meta Signed-off-by: shaoting-huang --- cpp/include/milvus-storage/common/serde.h | 2 - cpp/src/packed/writer.cpp | 1 - cpp/test/packed/packed_integration_test.cpp | 5 +- go/packed/column_offset_mapping.go | 58 --------------------- 4 files changed, 2 insertions(+), 64 deletions(-) delete mode 100644 go/packed/column_offset_mapping.go diff --git a/cpp/include/milvus-storage/common/serde.h b/cpp/include/milvus-storage/common/serde.h index efb403b..632fdd1 100644 --- a/cpp/include/milvus-storage/common/serde.h +++ b/cpp/include/milvus-storage/common/serde.h @@ -15,7 +15,6 @@ #pragma once #include #include -#include namespace milvus_storage { @@ -57,7 +56,6 @@ class PackedMetaSerde { } auto s = ss.str(); - std::cout << "SerializeColumnOffsets: " << s << std::endl; return s; } diff --git a/cpp/src/packed/writer.cpp b/cpp/src/packed/writer.cpp index 02cc011..b9b0c6d 100644 --- a/cpp/src/packed/writer.cpp +++ b/cpp/src/packed/writer.cpp @@ -72,7 +72,6 @@ Status PackedRecordBatchWriter::Write(const std::shared_ptr& } Status PackedRecordBatchWriter::splitAndWriteFirstBuffer() { - cout << "start split and write first buffer" << endl; auto max_group_size = buffered_batches_[0]->num_columns(); std::vector groups = SizeBasedSplitter(max_group_size, pk_index_, ts_index_).SplitRecordBatches(buffered_batches_); diff --git a/cpp/test/packed/packed_integration_test.cpp b/cpp/test/packed/packed_integration_test.cpp index fb7f889..4e54b08 100644 --- a/cpp/test/packed/packed_integration_test.cpp +++ b/cpp/test/packed/packed_integration_test.cpp @@ -45,12 +45,12 @@ TEST_F(PackedIntegrationTest, TestOneFile) { } TEST_F(PackedIntegrationTest, TestSplitColumnGroup) { - int batch_size = 1000; + int batch_size = 100000; std::vector column_offsets = { ColumnOffset(0, 0), + ColumnOffset(0, 1), ColumnOffset(1, 0), - ColumnOffset(1, 1), }; PackedRecordBatchWriter writer(writer_memory_, schema_, fs_, file_path_, pk_index_, ts_index_, storage_config_); @@ -58,7 +58,6 @@ TEST_F(PackedIntegrationTest, TestSplitColumnGroup) { EXPECT_TRUE(writer.Write(record_batch_).ok()); } EXPECT_TRUE(writer.Close().ok()); - std::cout << "writer closed" << std::endl; std::vector paths = {file_path_ + "/0", file_path_ + "/1"}; diff --git a/go/packed/column_offset_mapping.go b/go/packed/column_offset_mapping.go deleted file mode 100644 index e4f032e..0000000 --- a/go/packed/column_offset_mapping.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2023 Zilliz -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package packed - -/* -#include -#include "milvus-storage/packed/column_offset_mapping_c.h" -*/ -import "C" - -import ( - "fmt" - "unsafe" -) - -type ColumnOffset struct { - PathIndex int - ColIndex int -} - -func GetColumnOffsetMappingKeys(cColumnOffsetMapping C.CColumnOffsetMapping) ([]string, error) { - size := int(C.GetColumnOffsetMappingSize(cColumnOffsetMapping)) - if size == 0 { - return nil, fmt.Errorf("ColumnOffsetMapping is empty") - } - keys := make([]unsafe.Pointer, size) - - C.GetColumnOffsetMappingKeys(cColumnOffsetMapping, unsafe.Pointer(&keys[0])) - ret := make([]string, size) - for i := 0; i < size; i++ { - ret[i] = C.GoString((*C.char)(keys[i])) - } - return ret, nil -} - -func GetColumnOffset(cColumnOffsetMapping C.CColumnOffsetMapping, key string) (ColumnOffset, error) { - cKey := C.CString(key) - defer C.free(unsafe.Pointer(cKey)) - var cPathIndex, cColIndex C.int - - status := C.GetColumnOffset(cColumnOffsetMapping, cKey, &cPathIndex, &cColIndex) - if status != 0 { - return ColumnOffset{-1, -1}, fmt.Errorf("GetColumnOffset from key %s failed", key) - } - return ColumnOffset{int(cPathIndex), int(cColIndex)}, nil -}