alamb commented on code in PR #17921:
URL: https://github.com/apache/datafusion/pull/17921#discussion_r2408003461
##########
datafusion/ffi/src/udwf/mod.rs:
##########
@@ -336,9 +337,9 @@ impl WindowUDFImpl for ForeignWindowUDF {
let schema: SchemaRef = schema.into();
match schema.fields().is_empty() {
- true => Err(DataFusionError::Execution(
- "Unable to retrieve field in WindowUDF via
FFI".to_string(),
- )),
+ true => exec_err!(
+ "Unable to retrieve field in WindowUDF via FFI - schema
has no fields"
Review Comment:
👍
##########
datafusion/execution/src/task.rs:
##########
@@ -168,9 +168,10 @@ impl FunctionRegistry for TaskContext {
let result = self.window_functions.get(name);
result.cloned().ok_or_else(|| {
- DataFusionError::Internal(format!(
- "There is no UDWF named \"{name}\" in the TaskContext"
- ))
+ internal_datafusion_err!(
+ "There is no UDWF named \"{}\" in the TaskContext",
Review Comment:
why not keep the inline format?
```suggestion
"There is no UDWF named \"{name}\" in the TaskContext",
```
?
##########
datafusion/functions/src/encoding/inner.rs:
##########
@@ -309,18 +309,15 @@ fn hex_decode(input: &[u8], buf: &mut [u8]) ->
Result<usize> {
// only write input / 2 bytes to buf
let out_len = input.len() / 2;
let buf = &mut buf[..out_len];
- hex::decode_to_slice(input, buf).map_err(|e| {
- DataFusionError::Internal(format!("Failed to decode from hex: {e}"))
- })?;
+ hex::decode_to_slice(input, buf)
+ .map_err(|e| internal_datafusion_err!("Failed to decode from hex: {}",
e))?;
Ok(out_len)
}
fn base64_decode(input: &[u8], buf: &mut [u8]) -> Result<usize> {
general_purpose::STANDARD_NO_PAD
.decode_slice(input, buf)
- .map_err(|e| {
- DataFusionError::Internal(format!("Failed to decode from base64:
{e}"))
- })
+ .map_err(|e| internal_datafusion_err!("Failed to decode from base64:
{}", e))
Review Comment:
likewise in this this file, why not put the exception inline?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]