Skip to content

Update doc after rust / c++ panic fixes#395

Merged
luoyuxia merged 1 commit intoapache:mainfrom
leekeiabstraction:rust-result-doc
Mar 1, 2026
Merged

Update doc after rust / c++ panic fixes#395
luoyuxia merged 1 commit intoapache:mainfrom
leekeiabstraction:rust-result-doc

Conversation

@leekeiabstraction
Copy link
Contributor

Brief change log

Update doc after rust / c++ panic fixes

Tests

Verified examples / api doc changes with local test

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Rust client user-guide docs to match the recent change where InternalRow accessors return Result<T> (avoiding panics and requiring ? in examples).

Changes:

  • Updated multiple Rust code snippets to propagate errors from InternalRow getters via ?.
  • Updated the Rust API reference for InternalRow to show Result<…> return types and include is_null_at.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
website/docs/user-guide/rust/example/primary-key-tables.md Updates lookup example to use ? on row.get_* calls.
website/docs/user-guide/rust/example/partitioned-tables.md Updates partitioned lookup example to use ? on row.get_long.
website/docs/user-guide/rust/example/log-tables.md Updates log scanning examples to use ? on row.get_* calls.
website/docs/user-guide/rust/example/index.md Updates quickstart example to use ? on row.get_* calls.
website/docs/user-guide/rust/data-types.md Updates “Reading Row Data” example to use ? for null-check and getters.
website/docs/user-guide/rust/api-reference.md Updates InternalRow method signatures to return Result<…> and adds is_null_at.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +378 to +396
| Method | Description |
|----------------------------------------------------------------------------------------|-----------------------------------------|
| `fn is_null_at(&self, idx: usize) -> Result<bool>` | Check if a field is null |
| `fn get_boolean(&self, idx: usize) -> Result<bool>` | Get boolean value |
| `fn get_byte(&self, idx: usize) -> Result<i8>` | Get tinyint value |
| `fn get_short(&self, idx: usize) -> Result<i16>` | Get smallint value |
| `fn get_int(&self, idx: usize) -> Result<i32>` | Get int value |
| `fn get_long(&self, idx: usize) -> Result<i64>` | Get bigint value |
| `fn get_float(&self, idx: usize) -> Result<f32>` | Get float value |
| `fn get_double(&self, idx: usize) -> Result<f64>` | Get double value |
| `fn get_string(&self, idx: usize) -> Result<&str>` | Get string value |
| `fn get_decimal(&self, idx: usize, precision: usize, scale: usize) -> Result<Decimal>` | Get decimal value |
| `fn get_date(&self, idx: usize) -> Result<Date>` | Get date value |
| `fn get_time(&self, idx: usize) -> Result<Time>` | Get time value |
| `fn get_timestamp_ntz(&self, idx: usize, precision: u32) -> Result<TimestampNtz>` | Get timestamp value |
| `fn get_timestamp_ltz(&self, idx: usize, precision: u32) -> Result<TimestampLtz>` | Get timestamp with local timezone value |
| `fn get_bytes(&self, idx: usize) -> Result<&[u8]>` | Get bytes value |
| `fn get_binary(&self, idx: usize, length: usize) -> Result<&[u8]>` | Get fixed-length binary value |
| `fn get_char(&self, idx: usize, length: usize) -> Result<&str>` | Get fixed-length char value |
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The InternalRow trait API reference table is incomplete: the actual trait also defines get_field_count(&self) -> usize and as_encoded_bytes(...) -> Option<&[u8]> (with a default impl). Either add these methods to the table or clarify in the surrounding text that this table only documents the typed field getters/null-checks.

Suggested change
| Method | Description |
|----------------------------------------------------------------------------------------|-----------------------------------------|
| `fn is_null_at(&self, idx: usize) -> Result<bool>` | Check if a field is null |
| `fn get_boolean(&self, idx: usize) -> Result<bool>` | Get boolean value |
| `fn get_byte(&self, idx: usize) -> Result<i8>` | Get tinyint value |
| `fn get_short(&self, idx: usize) -> Result<i16>` | Get smallint value |
| `fn get_int(&self, idx: usize) -> Result<i32>` | Get int value |
| `fn get_long(&self, idx: usize) -> Result<i64>` | Get bigint value |
| `fn get_float(&self, idx: usize) -> Result<f32>` | Get float value |
| `fn get_double(&self, idx: usize) -> Result<f64>` | Get double value |
| `fn get_string(&self, idx: usize) -> Result<&str>` | Get string value |
| `fn get_decimal(&self, idx: usize, precision: usize, scale: usize) -> Result<Decimal>` | Get decimal value |
| `fn get_date(&self, idx: usize) -> Result<Date>` | Get date value |
| `fn get_time(&self, idx: usize) -> Result<Time>` | Get time value |
| `fn get_timestamp_ntz(&self, idx: usize, precision: u32) -> Result<TimestampNtz>` | Get timestamp value |
| `fn get_timestamp_ltz(&self, idx: usize, precision: u32) -> Result<TimestampLtz>` | Get timestamp with local timezone value |
| `fn get_bytes(&self, idx: usize) -> Result<&[u8]>` | Get bytes value |
| `fn get_binary(&self, idx: usize, length: usize) -> Result<&[u8]>` | Get fixed-length binary value |
| `fn get_char(&self, idx: usize, length: usize) -> Result<&str>` | Get fixed-length char value |
| Method | Description |
|----------------------------------------------------------------------------------------|---------------------------------------------------|
| `fn is_null_at(&self, idx: usize) -> Result<bool>` | Check if a field is null |
| `fn get_boolean(&self, idx: usize) -> Result<bool>` | Get boolean value |
| `fn get_byte(&self, idx: usize) -> Result<i8>` | Get tinyint value |
| `fn get_short(&self, idx: usize) -> Result<i16>` | Get smallint value |
| `fn get_int(&self, idx: usize) -> Result<i32>` | Get int value |
| `fn get_long(&self, idx: usize) -> Result<i64>` | Get bigint value |
| `fn get_float(&self, idx: usize) -> Result<f32>` | Get float value |
| `fn get_double(&self, idx: usize) -> Result<f64>` | Get double value |
| `fn get_string(&self, idx: usize) -> Result<&str>` | Get string value |
| `fn get_decimal(&self, idx: usize, precision: usize, scale: usize) -> Result<Decimal>` | Get decimal value |
| `fn get_date(&self, idx: usize) -> Result<Date>` | Get date value |
| `fn get_time(&self, idx: usize) -> Result<Time>` | Get time value |
| `fn get_timestamp_ntz(&self, idx: usize, precision: u32) -> Result<TimestampNtz>` | Get timestamp value |
| `fn get_timestamp_ltz(&self, idx: usize, precision: u32) -> Result<TimestampLtz>` | Get timestamp with local timezone value |
| `fn get_bytes(&self, idx: usize) -> Result<&[u8]>` | Get bytes value |
| `fn get_binary(&self, idx: usize, length: usize) -> Result<&[u8]>` | Get fixed-length binary value |
| `fn get_char(&self, idx: usize, length: usize) -> Result<&str>` | Get fixed-length char value |
| `fn get_field_count(&self) -> usize` | Get number of fields in the row |
| `fn as_encoded_bytes(...) -> Option<&[u8]>` | Access underlying encoded bytes representation |

Copilot uses AI. Check for mistakes.
Comment on lines +380 to +393
| `fn is_null_at(&self, idx: usize) -> Result<bool>` | Check if a field is null |
| `fn get_boolean(&self, idx: usize) -> Result<bool>` | Get boolean value |
| `fn get_byte(&self, idx: usize) -> Result<i8>` | Get tinyint value |
| `fn get_short(&self, idx: usize) -> Result<i16>` | Get smallint value |
| `fn get_int(&self, idx: usize) -> Result<i32>` | Get int value |
| `fn get_long(&self, idx: usize) -> Result<i64>` | Get bigint value |
| `fn get_float(&self, idx: usize) -> Result<f32>` | Get float value |
| `fn get_double(&self, idx: usize) -> Result<f64>` | Get double value |
| `fn get_string(&self, idx: usize) -> Result<&str>` | Get string value |
| `fn get_decimal(&self, idx: usize, precision: usize, scale: usize) -> Result<Decimal>` | Get decimal value |
| `fn get_date(&self, idx: usize) -> Result<Date>` | Get date value |
| `fn get_time(&self, idx: usize) -> Result<Time>` | Get time value |
| `fn get_timestamp_ntz(&self, idx: usize, precision: u32) -> Result<TimestampNtz>` | Get timestamp value |
| `fn get_timestamp_ltz(&self, idx: usize, precision: u32) -> Result<TimestampLtz>` | Get timestamp with local timezone value |
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this table the parameter name is documented as idx, but the Rust trait uses pos (and the surrounding GenericRow methods are documented with pos). Consider switching these signatures to pos for consistency with the actual API and the rest of this page.

Suggested change
| `fn is_null_at(&self, idx: usize) -> Result<bool>` | Check if a field is null |
| `fn get_boolean(&self, idx: usize) -> Result<bool>` | Get boolean value |
| `fn get_byte(&self, idx: usize) -> Result<i8>` | Get tinyint value |
| `fn get_short(&self, idx: usize) -> Result<i16>` | Get smallint value |
| `fn get_int(&self, idx: usize) -> Result<i32>` | Get int value |
| `fn get_long(&self, idx: usize) -> Result<i64>` | Get bigint value |
| `fn get_float(&self, idx: usize) -> Result<f32>` | Get float value |
| `fn get_double(&self, idx: usize) -> Result<f64>` | Get double value |
| `fn get_string(&self, idx: usize) -> Result<&str>` | Get string value |
| `fn get_decimal(&self, idx: usize, precision: usize, scale: usize) -> Result<Decimal>` | Get decimal value |
| `fn get_date(&self, idx: usize) -> Result<Date>` | Get date value |
| `fn get_time(&self, idx: usize) -> Result<Time>` | Get time value |
| `fn get_timestamp_ntz(&self, idx: usize, precision: u32) -> Result<TimestampNtz>` | Get timestamp value |
| `fn get_timestamp_ltz(&self, idx: usize, precision: u32) -> Result<TimestampLtz>` | Get timestamp with local timezone value |
| `fn is_null_at(&self, pos: usize) -> Result<bool>` | Check if a field is null |
| `fn get_boolean(&self, pos: usize) -> Result<bool>` | Get boolean value |
| `fn get_byte(&self, pos: usize) -> Result<i8>` | Get tinyint value |
| `fn get_short(&self, pos: usize) -> Result<i16>` | Get smallint value |
| `fn get_int(&self, pos: usize) -> Result<i32>` | Get int value |
| `fn get_long(&self, pos: usize) -> Result<i64>` | Get bigint value |
| `fn get_float(&self, pos: usize) -> Result<f32>` | Get float value |
| `fn get_double(&self, pos: usize) -> Result<f64>` | Get double value |
| `fn get_string(&self, pos: usize) -> Result<&str>` | Get string value |
| `fn get_decimal(&self, pos: usize, precision: usize, scale: usize) -> Result<Decimal>` | Get decimal value |
| `fn get_date(&self, pos: usize) -> Result<Date>` | Get date value |
| `fn get_time(&self, pos: usize) -> Result<Time>` | Get time value |
| `fn get_timestamp_ntz(&self, pos: usize, precision: u32) -> Result<TimestampNtz>` | Get timestamp value |
| `fn get_timestamp_ltz(&self, pos: usize, precision: u32) -> Result<TimestampLtz>` | Get timestamp with local timezone value |

Copilot uses AI. Check for mistakes.
@luoyuxia luoyuxia merged commit eae7b20 into apache:main Mar 1, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants