From 493139e9c850a9ae7c530ba2a2b72f0dc3059827 Mon Sep 17 00:00:00 2001 From: Alex Qyoun-ae <4062971+MazterQyou@users.noreply.github.com> Date: Thu, 23 Oct 2025 23:38:22 +0400 Subject: [PATCH] feat: Throw error on incorrect cast by default Signed-off-by: Alex Qyoun-ae <4062971+MazterQyou@users.noreply.github.com> --- arrow/src/compute/kernels/cast.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arrow/src/compute/kernels/cast.rs b/arrow/src/compute/kernels/cast.rs index a1f25f68ff43..ca15d9c1edde 100644 --- a/arrow/src/compute/kernels/cast.rs +++ b/arrow/src/compute/kernels/cast.rs @@ -63,6 +63,7 @@ pub struct CastOptions { } pub const DEFAULT_CAST_OPTIONS: CastOptions = CastOptions { safe: true }; +pub const CUBESQL_CAST_OPTIONS: CastOptions = CastOptions { safe: false }; /// Return true if a value of type `from_type` can be cast into a /// 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 { /// * List to primitive /// * Interval and duration pub fn cast(array: &ArrayRef, to_type: &DataType) -> Result { - cast_with_options(array, to_type, &DEFAULT_CAST_OPTIONS) + cast_with_options(array, to_type, &CUBESQL_CAST_OPTIONS) } // cast the integer array to defined decimal data type array