Skip to content

Commit 5b346b4

Browse files
authored
chore: modify comment in RecordBatch & add check in GenericRow (alibaba#314)
1 parent 32e919c commit 5b346b4

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

include/paimon/record_batch.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,22 @@ class PAIMON_EXPORT RecordBatchBuilder {
122122
/// @param data Map of partition column names to their string values.
123123
RecordBatchBuilder& SetPartition(const std::map<std::string, std::string>& data);
124124

125-
/// Set the bucket id for this record batch. If not set, default value is `-1`.
125+
/// Set the bucket id for this record batch. If not set, default value is `-2147483648`
126+
/// (i.e., `HasSpecifiedBucket()` returns false), and the bucket will be auto-resolved
127+
/// at write time based on the table's bucket option:
128+
///
129+
/// - **Unaware-bucket mode** (table option `bucket = -1`, append-only table without
130+
/// primary keys): the bucket will be auto-filled with `UNAWARE_BUCKET (0)`. If the
131+
/// caller does specify a bucket, it MUST be `UNAWARE_BUCKET (0)`, otherwise the
132+
/// write fails.
133+
/// - **Postpone-bucket mode** (table option `bucket = -2`, primary-key table whose
134+
/// bucket assignment is deferred): the bucket will be auto-filled with
135+
/// `POSTPONE_BUCKET (-2)`. If the caller does specify a bucket, it MUST be
136+
/// `POSTPONE_BUCKET (-2)`, otherwise the write fails.
137+
/// - **Fixed-bucket mode** (table option `bucket > 0`): the caller MUST explicitly
138+
/// call `SetBucket()` with a value in `[0, bucket)`; not calling `SetBucket()`
139+
/// (or passing an out-of-range value) will cause the write to fail.
140+
///
126141
/// @param bucket The bucket id for data distribution.
127142
RecordBatchBuilder& SetBucket(int32_t bucket);
128143

src/paimon/common/data/generic_row.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ class GenericRow : public InternalRow {
206206
if (this == &other) {
207207
return true;
208208
}
209-
return *kind_ == *other.kind_ && fields_ == other.fields_;
209+
bool kind_equal =
210+
(kind_ == other.kind_) || (kind_ && other.kind_ && *kind_ == *other.kind_);
211+
return kind_equal && fields_ == other.fields_;
210212
}
211213

212214
/// Creates an instance of GenericRow with given field values.

0 commit comments

Comments
 (0)