cloud-fan commented on code in PR #52638:
URL: https://github.com/apache/spark/pull/52638#discussion_r2473901347
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -1493,16 +1493,30 @@ class AstBuilder extends DataTypeAstBuilder
isDistinct = false,
isPipeOperatorSelect = false)
+ val recordWriterTokens = visitStringLit(transformClause.recordWriter)
+ val recordReaderTokens = visitStringLit(transformClause.recordReader)
+
+ // Record writer and reader should be single class names, not coalesced
strings.
+ // Assert to catch any misuse early while preserving the API.
+ assert(recordWriterTokens == null || recordWriterTokens.length <= 1,
+ s"Record writer must be a single string literal, got
${recordWriterTokens.length} literals")
+ assert(recordReaderTokens == null || recordReaderTokens.length <= 1,
+ s"Record reader must be a single string literal, got
${recordReaderTokens.length} literals")
+
ScriptTransformation(
string(visitStringLit(transformClause.script)),
attributes,
plan,
withScriptIOSchema(
ctx,
transformClause.inRowFormat,
- visitStringLit(transformClause.recordWriter),
+ if (recordWriterTokens != null && recordWriterTokens.nonEmpty) {
+ recordWriterTokens.head
+ } else null,
Review Comment:
```suggestion
transformClause.recordWriter
```
--
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]