dbtsai commented on code in PR #102:
URL:
https://github.com/apache/spark-connect-rust/pull/102#discussion_r4384179537
##########
crates/spark-connect/src/dataframe.rs:
##########
@@ -2640,14 +2647,150 @@ mod plan_construction_tests {
}
}
+ #[test]
+ fn transformations_and_clones_share_ancestors() {
+ use crate::functions::col;
+
+ let spark = session();
+ let source = spark.range(10).unwrap();
+ let original = source.plan.to_proto();
+ let cloned = source.clone();
+ assert!(Arc::ptr_eq(&source.plan, &cloned.plan));
+
+ let projected = source.select(vec![col("id")]);
+ let filtered = source.filter(col("id").gt(crate::column::lit(0)));
+ let limited = projected.limit(5);
+ let LogicalPlan::Project { input, .. } = projected.plan.as_ref() else {
+ panic!("expected projection");
+ };
+ assert!(Arc::ptr_eq(input, &source.plan));
+ let LogicalPlan::Filter { input, .. } = filtered.plan.as_ref() else {
+ panic!("expected filter");
+ };
+ assert!(Arc::ptr_eq(input, &source.plan));
+ let LogicalPlan::Limit { input, .. } = limited.plan.as_ref() else {
+ panic!("expected limit");
+ };
+ assert!(Arc::ptr_eq(input, &projected.plan));
+
+ let joined = projected.cross_join(&filtered);
+ let LogicalPlan::Join { left, right, .. } = joined.plan.as_ref() else {
+ panic!("expected join");
+ };
+ assert!(Arc::ptr_eq(left, &projected.plan));
+ assert!(Arc::ptr_eq(right, &filtered.plan));
+ assert_eq!(source.plan.to_proto(), original);
+ }
+
+ #[test]
+ fn long_chain_shares_each_previous_root() {
Review Comment:
Removed the repeated deep-plan and local-payload tests. Consolidated writer,
V2 writer, streaming, merge, and table-argument sharing into
`related_builders_share_the_source_plan` in `dataframe.rs`. Kept the
single-step ancestor-sharing checks and the shared self-join plan-ID uniqueness
test.
--
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]