[SPARK-45697][BUILD] Fix Unicode escapes in triple quoted strings are deprecated#43603
[SPARK-45697][BUILD] Fix Unicode escapes in triple quoted strings are deprecated#43603panbingkun wants to merge 11 commits intoapache:masterfrom
Unicode escapes in triple quoted strings are deprecated#43603Conversation
project/SparkBuild.scala
Outdated
| // reduce the cost of migration in subsequent versions. | ||
| "-Wconf:cat=deprecation&msg=it will become a keyword in Scala 3:e" | ||
| "-Wconf:cat=deprecation&msg=it will become a keyword in Scala 3:e", | ||
| "-Wconf:cat=deprecation&msg=Unicode escapes in triple quoted strings are deprecated:e" |
There was a problem hiding this comment.
this will be compile error in Scala 3?
There was a problem hiding this comment.
Only for test in GA.
I want it to run through GA first and see if there are any other similar issues besides the above modifications.
I will delete it later.
| List.empty, List.empty, None, None, false))) | ||
|
|
||
| // verify with ROW FORMAT DELIMETED | ||
| val collectionItemsTerminated1 = '\u0002' |
There was a problem hiding this comment.
- '\u0002' corresponds to "STX" (Start of Text), a non-printing character used to mark the beginning of text.
- '\u0003' corresponds to "ETX" (End of Text), a non-printing character used to mark the end of text.
- '\u0004' corresponds to "EOT" (End of Transmission), a non-printing character used to mark the end of transmission.
- '\u0005' corresponds to "ENQ" (Enquiry), a non-printing character used to inquire whether the receiving device is ready to receive data.
I'm not sure if this cases really need to test using non-printing characters as delimiters, can we use printable characters for testing, so we can replace them with the actual corresponding characters.
If indeed we need to test using non-printing characters as delimiters, I think we can add a @nowarn annotation to suppress warnings at a fine granularity like:
// verify with ROW FORMAT DELIMITED
@nowarn("cat=deprecation")
val sqlWithRowFormatDelimiters: String =
"""
|SELECT TRANSFORM(a, b, c)
| ROW FORMAT DELIMITED
| FIELDS TERMINATED BY '\t'
| COLLECTION ITEMS TERMINATED BY '\u0002'
| MAP KEYS TERMINATED BY '\u0003'
| LINES TERMINATED BY '\n'
| NULL DEFINED AS 'null'
| USING 'cat' AS (a, b, c)
| ROW FORMAT DELIMITED
| FIELDS TERMINATED BY '\t'
| COLLECTION ITEMS TERMINATED BY '\u0004'
| MAP KEYS TERMINATED BY '\u0005'
| LINES TERMINATED BY '\n'
| NULL DEFINED AS 'NULL'
|FROM testData
""".stripMargin
assertEqual(
sqlWithRowFormatDelimiters,| |FROM testData | ||
| """.stripMargin, | ||
| // verify with ROW FORMAT DELIMITED | ||
| val sqlWithRowFormatDelimited = |
| val sqlWithRowFormatDelimited = | ||
| "SELECT TRANSFORM(a, b, c)" + "\n" + | ||
| " ROW FORMAT DELIMITED" + "\n" + | ||
| """ FIELDS TERMINATED BY '\t'""" + "\n" + |
There was a problem hiding this comment.
friendly ping @AngersZhuuuu , do you have any suggestions about this deprecated usage issue
| | NULL DEFINED AS 'NULL' | ||
| |FROM testData | ||
| """.stripMargin, | ||
| "SELECT TRANSFORM(a, b, c)\n" + |
There was a problem hiding this comment.
Although this writing may seem ugly, it seems better than the previous version, haha
dongjoon-hyun
left a comment
There was a problem hiding this comment.
May I ask the status of this PR, @panbingkun ?
@dongjoon-hyun My modification principle is to |
|
To clarify: I am more inclined to understand the original intent of the test. If the goal is just to test different separators, we can use the literals of visible separators to eliminate this compile warning. If the original intent was to test invisible separators, then I think we can simply suppress the warning in this test. |
Okay, let's |
|
|
||
| // verify with ROW FORMAT DELIMETED | ||
| assertEqual( | ||
| @nowarn("cat=deprecation") |
There was a problem hiding this comment.
fine-grained suppressing this case with @nowarn if fine to me
pom.xml
Outdated
| reduce the cost of migration in subsequent versions. | ||
| --> | ||
| <arg>-Wconf:cat=deprecation&msg=it will become a keyword in Scala 3:e</arg> | ||
| <arg>-Wconf:cat=deprecation&msg=Unicode escapes in triple quoted strings are deprecated:e</arg> |
There was a problem hiding this comment.
@panbingkun please revert the change of SparkBuild.scala and pom.xml
|
Merged into master for Spark 4.0. Thanks @panbingkun |









What changes were proposed in this pull request?
The pr aims to fix
Unicode escapes in triple quoted strings are deprecatedin scala 2.13.Why are the changes needed?
Eliminate compile warnings.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Was this patch authored or co-authored using generative AI tooling?
No.