xiaonanyang-db commented on code in PR #50300: URL: https://github.com/apache/spark/pull/50300#discussion_r2034175548
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/xml/XmlExpressionEvalUtils.scala: ########## @@ -119,3 +122,49 @@ case class XPathListEvaluator(path: UTF8String) extends XPathEvaluator { } } } + +case class XmlToStructsEvaluator( + options: Map[String, String], + nullableSchema: DataType, + nameOfCorruptRecord: String, + timeZoneId: Option[String], + child: Expression +) { + @transient lazy val parsedOptions = new XmlOptions(options, timeZoneId.get, nameOfCorruptRecord) + + // This converts parsed rows to the desired output by the given schema. + @transient + private lazy val converter = + (rows: Iterator[InternalRow]) => if (rows.hasNext) rows.next() else null + + // Parser that parse XML strings as internal rows + @transient + private lazy val parser = { + val parsedOptions = new XmlOptions(options, timeZoneId.get, nameOfCorruptRecord) Review Comment: oh yeah, we should definitely do that -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org