adriangb commented on code in PR #22509:
URL: https://github.com/apache/datafusion/pull/22509#discussion_r3318815149
##########
datafusion/physical-expr/src/expressions/is_null.rs:
##########
@@ -223,4 +326,72 @@ mod tests {
Ok(())
}
+
+ #[cfg(feature = "proto")]
+ #[test]
+ fn is_null_proto_hook_roundtrip() -> Result<()> {
+ let arg = Arc::new(Column::new("a", 0)) as Arc<dyn PhysicalExpr>;
+ let expr = Arc::new(IsNullExpr::new(arg)) as Arc<dyn PhysicalExpr>;
+
+ let codec = TestProtoCodec;
+ let proto = codec.encode(&expr)?;
+
+ let is_null = match &proto.expr_type {
+ Some(protobuf::physical_expr_node::ExprType::IsNullExpr(is_null))
=> is_null,
+ other => panic!("Expected IsNullExpr proto, got {other:?}"),
+ };
+ assert!(matches!(
+ is_null
+ .expr
+ .as_deref()
+ .and_then(|expr| expr.expr_type.as_ref()),
+ Some(protobuf::physical_expr_node::ExprType::Column(_))
+ ));
+
+ let schema = Schema::new(vec![Field::new("a", DataType::Int64, true)]);
+ let decode_ctx = PhysicalExprDecodeCtx::new(&schema, &codec);
+ let decoded = IsNullExpr::try_from_proto(&proto, &decode_ctx)?;
+
+ assert_eq!(decoded.to_string(), "a@0 IS NULL");
+ Ok(())
+ }
+
+ #[cfg(feature = "proto")]
+ #[test]
Review Comment:
Same as
https://github.com/apache/datafusion/pull/22550#discussion_r3318792739 if you
make this its own test mod you won't need so much feature boilerplate
--
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]