|
18 | 18 | use crate::utils::is_valid_decimal_precision; |
19 | 19 | use arrow::datatypes::{DataType, Schema}; |
20 | 20 | use arrow::{ |
21 | | - array::{as_primitive_array, Array, Decimal128Array}, |
| 21 | + array::{as_primitive_array, Array}, |
22 | 22 | datatypes::Decimal128Type, |
23 | 23 | record_batch::RecordBatch, |
24 | 24 | }; |
@@ -113,21 +113,6 @@ impl PhysicalExpr for CheckOverflow { |
113 | 113 |
|
114 | 114 | let decimal_array = as_primitive_array::<Decimal128Type>(&array); |
115 | 115 |
|
116 | | - // Get input precision to check if we can skip validation |
117 | | - let (input_precision, input_scale) = match decimal_array.data_type() { |
118 | | - DataType::Decimal128(p, s) => (*p, *s), |
119 | | - _ => unreachable!(), |
120 | | - }; |
121 | | - |
122 | | - // Optimization: if input precision <= target precision and scales match, |
123 | | - // no overflow is possible - just update metadata |
124 | | - if input_precision <= target_precision && input_scale == target_scale { |
125 | | - let new_array = decimal_array |
126 | | - .clone() |
127 | | - .with_precision_and_scale(target_precision, target_scale)?; |
128 | | - return Ok(ColumnarValue::Array(Arc::new(new_array))); |
129 | | - } |
130 | | - |
131 | 116 | let result_array = if self.fail_on_error { |
132 | 117 | // ANSI mode: validate and return error on overflow |
133 | 118 | // Use optimized validation that avoids error string allocation until needed |
|
0 commit comments