fresh-borzoni commented on code in PR #349:
URL: https://github.com/apache/fluss-rust/pull/349#discussion_r2818994628
##########
website/docs/user-guide/cpp/api-reference.md:
##########
@@ -215,32 +201,122 @@ When using `table.NewRow()`, the `Set()` method
auto-routes to the correct type
| `Set(const std::string& name, const Time& value)` | Set time by
column name |
| `Set(const std::string& name, const Timestamp& value)` | Set timestamp by
column name |
-### Row Inspection
+## `RowView`
+
+Read-only row view for scan results. Provides zero-copy access to string and
bytes data.
+
+:::warning Lifetime
+`RowView` borrows from `ScanRecords`. It must not outlive the `ScanRecords`
that produced it (similar to `std::string_view` borrowing from `std::string`).
+:::
-| Method | Description |
-|------------------------------------|----------------------------------|
-| `FieldCount() -> size_t` | Get the number of fields |
-| `GetType(size_t idx) -> DatumType` | Get the datum type at index |
-| `IsNull(size_t idx) -> bool` | Check if field is null |
-| `IsDecimal(size_t idx) -> bool` | Check if field is a decimal type |
+### Index-Based Getters
+
+| Method | Description
|
+|------------------------------------------------------------|--------------------------------|
+| `FieldCount() -> size_t` | Get the number
of fields |
+| `GetType(size_t idx) -> TypeId` | Get the type at
index |
+| `IsNull(size_t idx) -> bool` | Check if field
is null |
+| `GetBool(size_t idx) -> bool` | Get boolean
value at index |
+| `GetInt32(size_t idx) -> int32_t` | Get 32-bit
integer at index |
+| `GetInt64(size_t idx) -> int64_t` | Get 64-bit
integer at index |
+| `GetFloat32(size_t idx) -> float` | Get 32-bit
float at index |
+| `GetFloat64(size_t idx) -> double` | Get 64-bit
float at index |
+| `GetString(size_t idx) -> std::string_view` | Get string at
index (zero-copy)|
+| `GetBytes(size_t idx) -> std::pair<const uint8_t*, size_t>`| Get binary data
at index (zero-copy)|
+| `GetDate(size_t idx) -> Date` | Get date at
index |
+| `GetTime(size_t idx) -> Time` | Get time at
index |
+| `GetTimestamp(size_t idx) -> Timestamp` | Get timestamp
at index |
+| `IsDecimal(size_t idx) -> bool` | Check if field
is a decimal type|
+| `GetDecimalString(size_t idx) -> std::string` | Get decimal as
string at index |
+
+### Name-Based Getters
+
+| Method | Description
|
+|---------------------------------------------------------|------------------------------------|
+| `IsNull(const std::string& name) -> bool` | Check if field is
null by name |
+| `GetBool(const std::string& name) -> bool` | Get boolean by
column name |
+| `GetInt32(const std::string& name) -> int32_t` | Get 32-bit integer
by column name |
+| `GetInt64(const std::string& name) -> int64_t` | Get 64-bit integer
by column name |
+| `GetFloat32(const std::string& name) -> float` | Get 32-bit float
by column name |
+| `GetFloat64(const std::string& name) -> double` | Get 64-bit float
by column name |
+| `GetString(const std::string& name) -> std::string_view`| Get string by
column name |
+| `GetBytes(const std::string& name) -> std::pair<const uint8_t*, size_t>` |
Get binary data by column name |
+| `GetDate(const std::string& name) -> Date` | Get date by column
name |
+| `GetTime(const std::string& name) -> Time` | Get time by column
name |
+| `GetTimestamp(const std::string& name) -> Timestamp` | Get timestamp by
column name |
+| `GetDecimalString(const std::string& name) -> std::string` | Get decimal as
string by column name |
## `ScanRecord`
-| Field | Type | Description |
-|-------------|--------------|-------------------------------|
-| `bucket_id` | `int32_t` | Bucket this record belongs to |
-| `offset` | `int64_t` | Record offset in the log |
-| `timestamp` | `int64_t` | Record timestamp |
-| `row` | `GenericRow` | Row data |
+:::warning Lifetime
+`ScanRecord` contains a `RowView` that borrows from `ScanRecords`. It must not
outlive the `ScanRecords` that produced it.
+:::
+
+| Field | Type | Description |
+|----------------|-------------------------|----------------------------------|
+| `bucket_id` | `int32_t` | Bucket this record belongs to |
+| `partition_id` | `std::optional<int64_t>`| Partition ID (if partitioned) |
+| `offset` | `int64_t` | Record offset in the log |
+| `timestamp` | `int64_t` | Record timestamp |
+| `change_type` | `ChangeType` | Type of change (see `ChangeType`)|
+| `row` | `RowView` | Read-only row view for field
access |
## `ScanRecords`
-| Method | Description
|
-|-----------------------------------------------|--------------------------------------------|
-| `Size() -> size_t` | Number of records
|
-| `Empty() -> bool` | Check if empty
|
-| `operator[](size_t idx) -> const ScanRecord&` | Access record by index
|
-| `begin() / end()` | Iterator support for
range-based for loops |
+| Method | Description
|
+|----------------------------------------|--------------------------------------------|
+| `Size() -> size_t` | Number of records
|
+| `Empty() -> bool` | Check if empty
|
+| `operator[](size_t idx) -> ScanRecord` | Access record by index
|
+| `GetColumnMap()` | Get column name-to-index map
(lazy-built, cached) |
Review Comment:
I should better make it private after second thought
--
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]