Skip to content

Commit

Permalink
[Fix] fix partition filter with null partition value (#545)
Browse files Browse the repository at this point in the history
Signed-off-by: zenghua <[email protected]>
Co-authored-by: zenghua <[email protected]>
  • Loading branch information
Ceng23333 and zenghua authored Sep 25, 2024
1 parent 5d0b522 commit d4f4578
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion rust/lakesoul-io/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,22 @@ pub fn format_scalar_value(v: &ScalarValue) -> String {

pub fn into_scalar_value(val: &str, data_type: &DataType) -> Result<ScalarValue> {
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)?))),
Expand Down

0 comments on commit d4f4578

Please sign in to comment.