viirya commented on code in PR #1122: URL: https://github.com/apache/datafusion-comet/pull/1122#discussion_r1859160709
########## native/spark-expr/src/list.rs: ########## @@ -708,6 +708,92 @@ impl PartialEq<dyn Any> for ArrayInsert { } } +#[derive(Debug, Hash)] +pub struct ArraySize { + src_array_expr: Arc<dyn PhysicalExpr>, +} + +impl ArraySize { + pub fn new(src_array_expr: Arc<dyn PhysicalExpr>) -> Self { + Self { src_array_expr } + } +} + +impl Display for ArraySize { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + write!(f, "ArraySize [array: {:?}]", self.src_array_expr) + } +} + +impl PartialEq<dyn Any> for ArraySize { + fn eq(&self, other: &dyn Any) -> bool { + down_cast_any_ref(other) + .downcast_ref::<Self>() + .map(|x| self.src_array_expr.eq(&x.src_array_expr)) + .unwrap_or(false) + } +} + +impl PhysicalExpr for ArraySize { + fn as_any(&self) -> &dyn Any { + self + } + + fn data_type(&self, _input_schema: &Schema) -> DataFusionResult<DataType> { + Ok(DataType::Int32) + } + + fn nullable(&self, input_schema: &Schema) -> DataFusionResult<bool> { + // Only non-nullable if fail_on_error is enabled and the element is non-nullable Review Comment: Is this copied from other expr? Looks like `ArraySize` doesn't have `fail_on_error`. -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org