From d4f45789e218b854c3ccd4613688676334329abb Mon Sep 17 00:00:00 2001 From: Ceng <441651826@qq.com> Date: Wed, 25 Sep 2024 17:40:32 +0800 Subject: [PATCH] [Fix] fix partition filter with null partition value (#545) Signed-off-by: zenghua Co-authored-by: zenghua --- rust/lakesoul-io/src/helpers.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/rust/lakesoul-io/src/helpers.rs b/rust/lakesoul-io/src/helpers.rs index e059824d0..8999a5d16 100644 --- a/rust/lakesoul-io/src/helpers.rs +++ b/rust/lakesoul-io/src/helpers.rs @@ -181,7 +181,22 @@ pub fn format_scalar_value(v: &ScalarValue) -> String { pub fn into_scalar_value(val: &str, data_type: &DataType) -> Result { if val.eq(LAKESOUL_NULL_STRING) { - Ok(ScalarValue::Null) + match data_type { + DataType::Date32 => Ok(ScalarValue::Date32(None)), + DataType::Utf8 => Ok(ScalarValue::Utf8(None)), + DataType::Timestamp(unit, timezone) => match unit { + TimeUnit::Second => Ok(ScalarValue::TimestampSecond(None, timezone.clone())), + TimeUnit::Millisecond => Ok(ScalarValue::TimestampMillisecond(None, timezone.clone())), + TimeUnit::Microsecond => Ok(ScalarValue::TimestampMicrosecond(None, timezone.clone())), + TimeUnit::Nanosecond => Ok(ScalarValue::TimestampNanosecond(None, timezone.clone())), + }, + DataType::Decimal128(p, s) => Ok(ScalarValue::Decimal128(None, *p, *s)), + DataType::Decimal256(p, s) => Ok(ScalarValue::Decimal256(None, *p, *s)), + DataType::Binary=> Ok(ScalarValue::Binary(None)), + DataType::FixedSizeBinary(size) => Ok(ScalarValue::FixedSizeBinary(*size, None)), + DataType::LargeBinary => Ok(ScalarValue::LargeBinary(None)), + _ => Ok(ScalarValue::Null), + } } else { match data_type { DataType::Date32 => Ok(ScalarValue::Date32(Some(date_str_to_epoch_days(val)?))),