dongjoon-hyun commented on code in PR #60373:
URL: https://github.com/apache/spark/pull/60373#discussion_r4553212625
##########
sql/core/src/test/scala/org/apache/spark/sql/DataFrameWriterV2Suite.scala:
##########
@@ -279,6 +279,19 @@ class DataFrameWriterV2Suite extends SharedSparkSession
with BeforeAndAfter {
Seq(Row(1L, "a"), Row(2L, "b"), Row(4L, "d"), Row(5L, "e"), Row(6L,
"f")))
}
+ test("SPARK-61504: Overwrite: overwrite by expression on a CHAR column") {
+ spark.sql(
+ "CREATE TABLE testcat.table_name (id bigint, dep char(8)) USING foo
PARTITIONED BY (dep)")
+ spark.sql("INSERT INTO testcat.table_name VALUES (1L, 'hr'), (2L,
'software')")
+
+ // the query is not resolved when the command is created, unlike the query
of a SQL INSERT
+ Seq((3L, "hr")).toDF("id",
"dep").writeTo("testcat.table_name").overwrite($"dep" === "hr")
Review Comment:
Thank you, @peter-toth. I confirmed the same: on this head, a row stored as
`hr` stays on both the DataFrame path and `REPLACE WHERE`, while the padded
rows are replaced.
I'll add this case to `DataFrameWriterV2Suite` in whichever of the two PRs
lands second.
- In this PR alone, a test of this case could only assert the wrong result.
- With both PRs, the test of this PR must change anyway. The overwrite of
`testcat` fails with `_LEGACY_ERROR_TEMP_2245`, since `InMemoryTable` doesn't
support `CHAR_READ_SIDE_PADDING`. On a `testv2filter` table with
`accept-char-read-side-padding`, the DataFrame overwrite replaces both the
padded row and the row stored without padding.
--
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]