jayzhan211 commented on code in PR #14289:
URL: https://github.com/apache/datafusion/pull/14289#discussion_r1929640010
##########
datafusion/physical-expr/src/scalar_function.rs:
##########
@@ -186,6 +186,56 @@ impl PhysicalExpr for ScalarFunctionExpr {
.map(|e| e.evaluate(batch))
.collect::<Result<Vec<_>>>()?;
+ if self.fun.signature().strict && args.iter().any(|arg|
arg.data_type().is_null())
+ {
+ let null_value = match &self.return_type {
+ DataType::Null => ScalarValue::Null,
+ DataType::Boolean => ScalarValue::Boolean(None),
+ DataType::Int8 => ScalarValue::Int8(None),
+ DataType::Int16 => ScalarValue::Int16(None),
+ DataType::Int32 => ScalarValue::Int32(None),
+ DataType::Int64 => ScalarValue::Int64(None),
+ DataType::UInt8 => ScalarValue::UInt8(None),
+ DataType::UInt16 => ScalarValue::UInt16(None),
+ DataType::UInt32 => ScalarValue::UInt32(None),
+ DataType::UInt64 => ScalarValue::UInt64(None),
+ DataType::Float16 => ScalarValue::Float16(None),
+ DataType::Float32 => ScalarValue::Float32(None),
+ DataType::Float64 => ScalarValue::Float64(None),
+ DataType::Timestamp(_, _) => todo!(),
+ DataType::Date32 => todo!(),
+ DataType::Date64 => todo!(),
+ DataType::Time32(_) => todo!(),
+ DataType::Time64(_) => todo!(),
+ DataType::Duration(_) => todo!(),
+ DataType::Interval(_) => todo!(),
+ DataType::Binary => todo!(),
+ DataType::FixedSizeBinary(_) => todo!(),
+ DataType::LargeBinary => todo!(),
+ DataType::BinaryView => todo!(),
+ DataType::Utf8 => todo!(),
+ DataType::LargeUtf8 => todo!(),
+ DataType::Utf8View => todo!(),
+ DataType::List(field_ref) => ScalarValue::List(Arc::new(
+ ListArray::new_null(Arc::clone(field_ref), 1),
+ )),
+ DataType::ListView(_) => todo!(),
+ DataType::FixedSizeList(_, _) => todo!(),
+ DataType::LargeList(field_ref) =>
ScalarValue::LargeList(Arc::new(
+ LargeListArray::new_null(Arc::clone(field_ref), 1),
+ )),
+ DataType::LargeListView(_) => todo!(),
+ DataType::Struct(_) => todo!(),
+ DataType::Union(_, _) => todo!(),
+ DataType::Dictionary(_, _) => todo!(),
+ DataType::Decimal128(_, _) => todo!(),
+ DataType::Decimal256(_, _) => todo!(),
+ DataType::Map(_, _) => todo!(),
+ DataType::RunEndEncoded(_, _) => todo!(),
+ };
Review Comment:
```rust
let null_value = ScalarValue::try_from(self.return_type.clone())?;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]