sunchao commented on code in PR #56685:
URL: https://github.com/apache/spark/pull/56685#discussion_r3462308060
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/json/JsonExpressionEvalUtils.scala:
##########
@@ -575,24 +575,32 @@ case class GetJsonObjectEvaluator(cachedPath: UTF8String)
{
}
/**
- * Evaluates multiple simple top-level JSON fields in one parse.
+ * Evaluates multiple simple named JSON paths in one parse.
*/
case class MultiGetJsonObjectEvaluator(
- fieldNames: Seq[String],
- fallbackPaths: Seq[UTF8String]) {
+ fallbackPaths: Seq[UTF8String],
+ namedPaths: Seq[Seq[String]]) {
import SharedFactory._
require(
- fieldNames.nonEmpty &&
- fieldNames.distinct.length == fieldNames.length &&
- fallbackPaths.length == fieldNames.length)
+ fallbackPaths.nonEmpty &&
+ namedPaths.length == fallbackPaths.length)
Review Comment:
Thanks, addressed in 6754fbf286f. The validation `require` is now a single
line.
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/json/JsonExpressionEvalUtils.scala:
##########
@@ -726,3 +791,45 @@ case class MultiGetJsonObjectEvaluator(
if (renderingFailed) None else
Some(UTF8String.fromBytes(outputBuffer.toByteArray))
}
}
+
+object MultiGetJsonObjectEvaluator {
+ private final class MutablePathTrieNode {
+ val terminalOrdinals: scala.collection.mutable.ArrayBuffer[Int] =
+ scala.collection.mutable.ArrayBuffer.empty
+ val children: scala.collection.mutable.LinkedHashMap[String,
MutablePathTrieNode] =
+ scala.collection.mutable.LinkedHashMap.empty
Review Comment:
Thanks, addressed in 6754fbf286f. I imported `scala.collection.mutable` and
shortened the four fully qualified references.
--
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]