beliefer commented on code in PR #43710:
URL: https://github.com/apache/spark/pull/43710#discussion_r1386220959
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/xml/XmlSuite.scala:
##########
@@ -30,12 +30,13 @@ import org.apache.commons.lang3.exception.ExceptionUtils
import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.io.{LongWritable, Text}
import org.apache.hadoop.io.compress.GzipCodec
-
Review Comment:
Please revert it.
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/xml/XmlSuite.scala:
##########
@@ -30,12 +30,13 @@ import org.apache.commons.lang3.exception.ExceptionUtils
import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.io.{LongWritable, Text}
import org.apache.hadoop.io.compress.GzipCodec
-
import org.apache.spark.SparkException
+
Review Comment:
ditto.
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala:
##########
@@ -3805,4 +3805,11 @@ private[sql] object QueryCompilationErrors extends
QueryErrorsBase with Compilat
errorClass = "DATA_SOURCE_ALREADY_EXISTS",
messageParameters = Map("provider" -> name))
}
+
+ def xmlRowTagRequiredError(optionName: String): Throwable = {
+ new AnalysisException(
+ errorClass = "XML_ROW_TAG_OPTION_REQUIRED",
+ messageParameters = Map("rowTag" -> optionName)
Review Comment:
```suggestion
messageParameters = Map("rowTag" -> toSQLId(optionName))
```
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/xml/XmlOptions.scala:
##########
@@ -66,7 +66,11 @@ private[sql] class XmlOptions(
val compressionCodec =
parameters.get(COMPRESSION).map(CompressionCodecs.getCodecClassName)
val rowTagOpt = parameters.get(XmlOptions.ROW_TAG).map(_.trim)
- require(!rowTagRequired || rowTagOpt.isDefined, s"'${XmlOptions.ROW_TAG}'
option is required.")
+
+ if (rowTagRequired && rowTagOpt.isEmpty) {
+ throw QueryCompilationErrors.xmlRowTagRequiredError(XmlOptions.ROW_TAG)
Review Comment:
Because `val rowTag = rowTagOpt.getOrElse(XmlOptions.DEFAULT_ROW_TAG)`, do
we really need throw the error?
--
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]