acruise commented on code in PR #55905:
URL: https://github.com/apache/spark/pull/55905#discussion_r3249903746
##########
sql/core/src/test/scala/org/apache/spark/sql/DataFrameSetOperationsSuite.scala:
##########
@@ -1642,6 +1642,35 @@ class DataFrameSetOperationsSuite extends
SharedSparkSession with AdaptiveSparkP
}
}
}
+
+ test("SPARK-51262: exceptAll after dropDuplicates with subset should not
throw") {
+ val df1 = spark.createDataFrame(Seq(
+ (1, "a", 100),
+ (1, "a", 200),
+ (2, "b", 300)
+ )).toDF("id", "name", "value")
+
+ val df2 = spark.createDataFrame(Seq(
+ (1, "a", 100)
+ )).toDF("id", "name", "value")
+
+ // dropDuplicates with subset keeps one row per (id, name) group
+ val deduped = df1.dropDuplicates("id", "name")
+
+ // exceptAll should work without INTERNAL_ERROR_ATTRIBUTE_NOT_FOUND
+ val result = deduped.exceptAll(df2)
+ assert(result.columns === Array("id", "name", "value"))
+ assert(result.count() === 1)
+ assert(result.collect().head.getInt(0) === 2)
+
+ // Also verify except (non-all) works
+ val result2 = deduped.except(df2)
+ assert(result2.count() === 1)
+
+ // intersectAll should also work
+ val result3 = deduped.intersectAll(df2)
+ assert(result3.count() <= 1)
Review Comment:
A bit silly but it might be nice to check that the correct values survive,
not just expected number of values ;)
##########
sql/core/src/test/scala/org/apache/spark/sql/DataFrameSetOperationsSuite.scala:
##########
@@ -1642,6 +1642,35 @@ class DataFrameSetOperationsSuite extends
SharedSparkSession with AdaptiveSparkP
}
}
}
+
+ test("SPARK-51262: exceptAll after dropDuplicates with subset should not
throw") {
+ val df1 = spark.createDataFrame(Seq(
+ (1, "a", 100),
+ (1, "a", 200),
+ (2, "b", 300)
+ )).toDF("id", "name", "value")
+
+ val df2 = spark.createDataFrame(Seq(
+ (1, "a", 100)
+ )).toDF("id", "name", "value")
+
+ // dropDuplicates with subset keeps one row per (id, name) group
+ val deduped = df1.dropDuplicates("id", "name")
+
+ // exceptAll should work without INTERNAL_ERROR_ATTRIBUTE_NOT_FOUND
+ val result = deduped.exceptAll(df2)
+ assert(result.columns === Array("id", "name", "value"))
+ assert(result.count() === 1)
+ assert(result.collect().head.getInt(0) === 2)
+
+ // Also verify except (non-all) works
+ val result2 = deduped.except(df2)
+ assert(result2.count() === 1)
+
+ // intersectAll should also work
+ val result3 = deduped.intersectAll(df2)
+ assert(result3.count() <= 1)
Review Comment:
A bit silly but it might be nice to check that the correct values survive,
not just the expected number of values ;)
--
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]