You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2021/02/22 13:28:48 UTC
[arrow] branch master updated: ARROW-11722: [Rust] Improve error
message in FFI cast.
This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new 879e32d ARROW-11722: [Rust] Improve error message in FFI cast.
879e32d is described below
commit 879e32d5f561df46e8f646fea8a3b3dca97d2500
Author: Ritchie Vink <ri...@gmail.com>
AuthorDate: Mon Feb 22 08:27:38 2021 -0500
ARROW-11722: [Rust] Improve error message in FFI cast.
While trying to cast from pyarrow to rust I encountered the following error message: `CDataInterface("The datatype \"{}\" is still not supported in Rust implementation")`, which is not very informative.
This PR is very small and prints the datatype format passed to the function in the error message.
Closes #9540 from ritchie46/improve_ffi_error
Authored-by: Ritchie Vink <ri...@gmail.com>
Signed-off-by: Andrew Lamb <an...@nerdnetworks.org>
---
rust/arrow/src/ffi.rs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/rust/arrow/src/ffi.rs b/rust/arrow/src/ffi.rs
index 528a518..ffaf742 100644
--- a/rust/arrow/src/ffi.rs
+++ b/rust/arrow/src/ffi.rs
@@ -193,11 +193,11 @@ fn to_datatype(format: &str) -> Result<DataType> {
"ttm" => DataType::Time32(TimeUnit::Millisecond),
"ttu" => DataType::Time64(TimeUnit::Microsecond),
"ttn" => DataType::Time64(TimeUnit::Nanosecond),
- _ => {
- return Err(ArrowError::CDataInterface(
- "The datatype \"{}\" is still not supported in Rust implementation"
- .to_string(),
- ))
+ dt => {
+ return Err(ArrowError::CDataInterface(format!(
+ "The datatype \"{}\" is not supported in the Rust implementation",
+ dt
+ )))
}
})
}