luoyuxia commented on code in PR #351:
URL: https://github.com/apache/fluss-rust/pull/351#discussion_r2837016428
##########
bindings/cpp/include/fluss.hpp:
##########
@@ -660,29 +670,90 @@ class RowView : public detail::NamedGetters<RowView> {
private:
size_t Resolve(const std::string& name) const {
- if (!column_map_) {
+ if (!data_) {
throw std::runtime_error("RowView: name-based access not
available");
}
- return detail::ResolveColumn(*column_map_, name);
+ return detail::ResolveColumn(data_->columns, name);
+ }
+ std::shared_ptr<const detail::ScanData> data_;
+ size_t bucket_idx_;
+ size_t rec_idx_;
+};
+
+/// Identifies a specific bucket, optionally within a partition.
+struct TableBucket {
+ int64_t table_id;
+ int32_t bucket_id;
+ std::optional<int64_t> partition_id;
+
+ bool operator==(const TableBucket& other) const {
+ return table_id == other.table_id && bucket_id == other.bucket_id &&
+ partition_id == other.partition_id;
}
- std::shared_ptr<const ffi::ScanResultInner> inner_;
- size_t record_idx_;
- std::shared_ptr<const detail::ColumnMap> column_map_;
+
+ bool operator!=(const TableBucket& other) const { return !(*this ==
other); }
};
/// A single scan record. Contains metadata and a RowView for field access.
///
/// ScanRecord is a value type that can be freely copied, stored, and
/// accumulated across multiple Poll() calls.
struct ScanRecord {
- int32_t bucket_id;
- std::optional<int64_t> partition_id;
int64_t offset;
int64_t timestamp;
ChangeType change_type;
RowView row;
};
+/// A view into a subset of scan results for a single bucket.
+///
+/// BucketView is a value type — it shares ownership of the underlying scan
data
+/// via reference counting, so it can safely outlive the ScanRecords that
produced it.
+class BucketView {
Review Comment:
Although this has been merged, after thinking about it again, I'd still like
to discuss the naming since it's a public user-facing API. BucketView gives me
the impression that it's a view of a bucket, but it's actually a bundle of
records belonging to a bucket. So I'm wondering whether `BucketRecords` would
be a more intuitive name? What do you think? @fresh-borzoni
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]