shrirangmhalgi commented on code in PR #55905:
URL: https://github.com/apache/spark/pull/55905#discussion_r3250807811
##########
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:
I realized that the test dataframe can cause non deterministic rows to be
picked up. To avoid test flakiness i modified the test data to produce
deterministic results keeping all the dataframe rows unique.
The issue persisted and the proposed fix works on new dataset as well. 😊
--
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]