1414 * limitations under the License.
1515 */
1616
17- #include " paimon/core/mergetree/binary_in_memory_sort_buffer .h"
17+ #include " paimon/core/mergetree/in_memory_sort_buffer .h"
1818
1919#include < cassert>
2020#include < utility>
3333
3434namespace paimon {
3535
36- BinaryInMemorySortBuffer::BinaryInMemorySortBuffer (
37- int64_t last_sequence_number, const std::shared_ptr<arrow::DataType>& value_type,
38- const std::vector<std::string>& trimmed_primary_keys,
39- const std::vector<std::string>& user_defined_sequence_fields, bool sequence_fields_ascending,
40- const std::shared_ptr<FieldsComparator>& key_comparator, uint64_t write_buffer_size,
41- const std::shared_ptr<MemoryPool>& pool)
36+ InMemorySortBuffer::InMemorySortBuffer (int64_t last_sequence_number,
37+ const std::shared_ptr<arrow::DataType>& value_type,
38+ const std::vector<std::string>& trimmed_primary_keys,
39+ const std::vector<std::string>& user_defined_sequence_fields,
40+ bool sequence_fields_ascending,
41+ const std::shared_ptr<FieldsComparator>& key_comparator,
42+ uint64_t write_buffer_size,
43+ const std::shared_ptr<MemoryPool>& pool)
4244 : pool_(pool),
4345 value_type_ (value_type),
4446 trimmed_primary_keys_(trimmed_primary_keys),
@@ -48,20 +50,20 @@ BinaryInMemorySortBuffer::BinaryInMemorySortBuffer(
4850 write_buffer_size_(write_buffer_size),
4951 next_sequence_number_(last_sequence_number + 1 ) {}
5052
51- void BinaryInMemorySortBuffer ::Clear () {
53+ void InMemorySortBuffer ::Clear () {
5254 buffered_batches_.clear ();
5355 current_memory_in_bytes_ = 0 ;
5456}
5557
56- uint64_t BinaryInMemorySortBuffer ::GetMemorySize () const {
58+ uint64_t InMemorySortBuffer ::GetMemorySize () const {
5759 return current_memory_in_bytes_;
5860}
5961
60- Result<bool > BinaryInMemorySortBuffer ::FlushMemory () {
62+ Result<bool > InMemorySortBuffer ::FlushMemory () {
6163 return false ;
6264}
6365
64- Result<bool > BinaryInMemorySortBuffer ::Write (std::unique_ptr<RecordBatch>&& moved_batch) {
66+ Result<bool > InMemorySortBuffer ::Write (std::unique_ptr<RecordBatch>&& moved_batch) {
6567 if (ArrowArrayIsReleased (moved_batch->GetData ())) {
6668 return Status::Invalid (" invalid batch: data is released" );
6769 }
@@ -84,8 +86,7 @@ Result<bool> BinaryInMemorySortBuffer::Write(std::unique_ptr<RecordBatch>&& move
8486 return current_memory_in_bytes_ < write_buffer_size_;
8587}
8688
87- Result<std::vector<std::unique_ptr<KeyValueRecordReader>>>
88- BinaryInMemorySortBuffer::CreateReaders () {
89+ Result<std::vector<std::unique_ptr<KeyValueRecordReader>>> InMemorySortBuffer::CreateReaders () {
8990 std::vector<std::unique_ptr<KeyValueRecordReader>> readers;
9091 if (buffered_batches_.empty ()) {
9192 return readers;
@@ -102,14 +103,13 @@ BinaryInMemorySortBuffer::CreateReaders() {
102103 return readers;
103104}
104105
105- bool BinaryInMemorySortBuffer ::HasData () const {
106+ bool InMemorySortBuffer ::HasData () const {
106107 return !buffered_batches_.empty ();
107108}
108109
109110// TODO(jinli.zjw): Consider making the memory estimation more accurate.
110111// https://github.com/alibaba/paimon-cpp/pull/206#discussion_r3021325389
111- Result<int64_t > BinaryInMemorySortBuffer::EstimateMemoryUse (
112- const std::shared_ptr<arrow::Array>& array) {
112+ Result<int64_t > InMemorySortBuffer::EstimateMemoryUse (const std::shared_ptr<arrow::Array>& array) {
113113 arrow::Type::type type = array->type ()->id ();
114114 int64_t null_bits_size_in_bytes = (array->length () + 7 ) / 8 ;
115115 switch (type) {
0 commit comments