Skip to content

Commit 05b53fd

Browse files
committed
Improve test
1 parent b6c14b7 commit 05b53fd

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

datafusion-federation/src/schema_cast/record_convert.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -327,15 +327,20 @@ mod test {
327327

328328
let err =
329329
try_cast_to(batch, target_schema).expect_err("Decimal overflow should return an error");
330-
assert!(
331-
matches!(err, Error::UnableToCastColumn { .. }),
332-
"Expected UnableToCastColumn, got: {err:?}"
333-
);
334-
let err_msg = err.to_string();
335-
assert!(
336-
err_msg.contains("is too large to store in a Decimal128"),
337-
"Expected overflow message, got: {err_msg}"
338-
);
330+
match &err {
331+
Error::UnableToCastColumn {
332+
source: arrow_err, ..
333+
} => {
334+
assert!(
335+
matches!(
336+
arrow_err,
337+
datafusion::arrow::error::ArrowError::InvalidArgumentError(_)
338+
),
339+
"Expected InvalidArgumentError, got: {arrow_err:?}"
340+
);
341+
}
342+
other => panic!("Expected UnableToCastColumn, got: {other:?}"),
343+
}
339344
}
340345

341346
/// Casting Decimal128 with values that fit should succeed.

0 commit comments

Comments
 (0)