Skip to content

Commit 8277f9a

Browse files
committed
feat: Throw error on incorrect cast by default
Signed-off-by: Alex Qyoun-ae <[email protected]>
1 parent a03d4ee commit 8277f9a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arrow/src/compute/kernels/cast.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ pub struct CastOptions {
6363
}
6464

6565
pub const DEFAULT_CAST_OPTIONS: CastOptions = CastOptions { safe: true };
66+
pub const CUBESQL_CAST_OPTIONS: CastOptions = CastOptions { safe: false };
6667

6768
/// Return true if a value of type `from_type` can be cast into a
6869
/// value of `to_type`. Note that such as cast may be lossy.
@@ -314,7 +315,7 @@ pub fn can_cast_types(from_type: &DataType, to_type: &DataType) -> bool {
314315
/// * List to primitive
315316
/// * Interval and duration
316317
pub fn cast(array: &ArrayRef, to_type: &DataType) -> Result<ArrayRef> {
317-
cast_with_options(array, to_type, &DEFAULT_CAST_OPTIONS)
318+
cast_with_options(array, to_type, &CUBESQL_CAST_OPTIONS)
318319
}
319320

320321
// cast the integer array to defined decimal data type array

0 commit comments

Comments
 (0)