jose-torres commented on code in PR #58645:
URL: https://github.com/apache/spark/pull/58645#discussion_r4084944608
##########
sql/pipelines/src/main/scala/org/apache/spark/sql/pipelines/autocdc/Scd2VersionMap.scala:
##########
@@ -77,15 +83,69 @@ private[pipelines] object Scd2VersionMap {
/**
* Schema of the version map: `Map(String, Boolean)`.
*
- * Keys are dot-delimited paths to *leaf* columns that received a null value
in their
- * corresponding upsert event (e.g. `"address.city"`, `` "`has space`.city"
``). Paths
- * must be formatted by
[[org.apache.spark.sql.catalyst.util.QuotingUtils.quoted]] to
- * ensure segments that need quoting are back-tick escaped.
+ * Keys are compact JSON arrays of the name parts of *leaf* columns that
received a null
+ * value in their upsert event (e.g. `["address","city"]`). Keeping
+ * name parts separate distinguishes a nested path from a column whose name
contains dots
+ * and keeps persisted keys independent of SQL identifier quoting rules.
Name parts use the
+ * persisted target schema's canonical spelling.
*
- * Values indicate authorship. I.e, `true` => authored-null, `false` =>
unauthored-null.
+ * Values indicate authorship: `true` means authored-null, `false` means
unauthored-null.
+ * Null values never appear in the map.
*
* Lack of entry in the map for a null-valued leaf column implies the column
was
* schema-evolved with an unauthored-null.
*/
def mapType: MapType = MapType(StringType, BooleanType, valueContainsNull =
false)
+
+ /** Encodes a leaf path as the compact JSON string persisted as its version
map key. */
Review Comment:
Makes sense. My instinct is that it would also be a risk for the canonical
form here to diverge from the standard serialization without some sort of test
failure. Maybe it's enough for the test assertions to capture the literal
string.
--
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]