tobixdev commented on code in PR #17986:
URL: https://github.com/apache/datafusion/pull/17986#discussion_r2450605434
##########
datafusion/proto/tests/cases/roundtrip_logical_plan.rs:
##########
@@ -1071,6 +1071,37 @@ async fn roundtrip_logical_plan_with_view_scan() ->
Result<()> {
Ok(())
}
+#[tokio::test]
+async fn roundtrip_logical_plan_prepared_statement_with_metadata() ->
Result<()> {
+ let ctx = SessionContext::new();
+
+ let plan = ctx
+ .sql("SELECT $1")
+ .await
+ .unwrap()
+ .into_optimized_plan()
+ .unwrap();
+ let prepared = LogicalPlanBuilder::new(plan)
+ .prepare(
+ "".to_string(),
+ vec![Field::new("", DataType::Int32, true)
+ .with_metadata(
+ [("some_key".to_string(),
"some_value".to_string())].into(),
+ )
+ .into()],
+ )
+ .unwrap()
+ .plan()
+ .clone();
+
+ let bytes = logical_plan_to_bytes(&prepared)?;
+ let logical_round_trip = logical_plan_from_bytes(&bytes, &ctx)?;
+ assert_eq!(format!("{prepared}"), format!("{logical_round_trip}"));
+ // Also check exact equality in case metadata isn't reflected in the
display string
Review Comment:
I guess there is some reason why both checks have been employed. Maybe
better to stay on the safe side here.
--
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]