Skip to content

Commit 853c5f2

Browse files
authored
Support cast decimal data type with different precision and sale (#839)
1 parent 6cf2894 commit 853c5f2

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • native-engine/datafusion-ext-plans/src/scan

native-engine/datafusion-ext-plans/src/scan/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,9 @@ fn schema_adapter_cast_column(col: &ArrayRef, data_type: &DataType) -> Result<Ar
171171
DataType::Int16 => handle_decimal!(Int16, Decimal128, i128, *prec, *scale),
172172
DataType::Int32 => handle_decimal!(Int32, Decimal128, i128, *prec, *scale),
173173
DataType::Int64 => handle_decimal!(Int64, Decimal128, i128, *prec, *scale),
174-
DataType::Decimal128(p, s) if p == prec && s == scale => Ok(col.clone()),
174+
DataType::Decimal128(p, s) => {
175+
datafusion_ext_commons::arrow::cast::cast_scan_input_array(col.as_ref(), data_type)
176+
}
175177
_ => df_execution_err!(
176178
"schema_adapter_cast_column unsupported type: {:?} => {:?}",
177179
col.data_type(),

0 commit comments

Comments
 (0)