Skip to content

Commit df376fb

Browse files
committed
support GlobalIndexResult serialize and deserialize
1 parent 2e42335 commit df376fb

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

include/paimon/global_index/global_index_result.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,32 @@ class PAIMON_EXPORT GlobalIndexResult : public std::enable_shared_from_this<Glob
6565

6666
virtual std::string ToString() const = 0;
6767

68+
/// Serializes a GlobalIndexResult object into a byte array.
69+
///
70+
/// @note This method only supports the following concrete implementations:
71+
/// - BitmapTopKGlobalIndexResult
72+
/// - BitmapGlobalIndexResult
73+
///
74+
/// @param global_index_result The GlobalIndexResult instance to serialize (must not be null).
75+
/// @param pool Memory pool used to allocate the output byte buffer.
76+
/// @return A Result containing a unique pointer to the serialized Bytes on success,
77+
/// or an error status on failure.
6878
static Result<PAIMON_UNIQUE_PTR<Bytes>> Serialize(
6979
const std::shared_ptr<GlobalIndexResult>& global_index_result,
7080
const std::shared_ptr<MemoryPool>& pool);
7181

82+
/// Deserializes a GlobalIndexResult object from a raw byte buffer.
83+
///
84+
/// @note The concrete type of the deserialized object is determined by metadata
85+
/// embedded in the buffer. Currently, only the following types are supported:
86+
/// - BitmapTopKGlobalIndexResult
87+
/// - BitmapGlobalIndexResult
88+
///
89+
/// @param buffer Pointer to the serialized byte data (must not be null).
90+
/// @param length Size of the buffer in bytes.
91+
/// @param pool Memory pool used to allocate internal objects during deserialization.
92+
/// @return A Result containing a shared pointer to the reconstructed GlobalIndexResult
93+
/// on success, or an error status on failure.
7294
static Result<std::shared_ptr<GlobalIndexResult>> Deserialize(
7395
const char* buffer, size_t length, const std::shared_ptr<MemoryPool>& pool);
7496

0 commit comments

Comments
 (0)