cloud-fan commented on code in PR #59188:
URL: https://github.com/apache/spark/pull/59188#discussion_r4210344356
##########
sql/core/src/test/scala/org/apache/spark/sql/CharVarcharTestSuite.scala:
##########
@@ -2635,44 +2635,89 @@ class BasicCharVarcharTestSuite extends
SharedSparkSession {
test("SPARK-59274: from_json/csv/xml honor CHAR/VARCHAR under
standardSemantics") {
withSQLConf(SQLConf.CHAR_VARCHAR_STANDARD_SEMANTICS.key -> "true") {
- def checkTextInput(query: String, inputType: DataType): DataFrame = {
- val df = sql(query)
- val inputTypes =
df.queryExecution.analyzed.expressions.flatMap(_.collect {
- case e: SupportTrimmedCharInput => e.child.dataType
- })
- assert(inputTypes === Seq(inputType), df.queryExecution.analyzed)
- df
- }
-
+ // CHAR padding is part of the STRING value after CAST. Parsers do not
rtrim it.
Review Comment:
**Nit (P3):** This absolute statement conflicts with the
`ignoreTrailingWhiteSpace=true` case below, where CSV does consume the trailing
padding. It can mislead maintainers into thinking parser-level whitespace
options no longer apply; the guarantee here is specifically that the document
expression no longer unconditionally pre-trims CHAR input before parsing.
**Verification:**
- **Inspection:** Confirm that the explanatory wording is consistent with
both default preservation of padded CHAR document input and format-specific
trimming enabled by parser options.
--
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]