dtenedor commented on code in PR #48908:
URL: https://github.com/apache/spark/pull/48908#discussion_r1857425623
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/json/JsonExpressionEvalUtils.scala:
##########
@@ -159,3 +160,90 @@ case class StructsToJsonEvaluator(
converter(value)
}
}
+
+case class JsonTupleEvaluator(fieldsLength: Int) {
+
+ import SharedFactory._
+
+ // if processing fails this shared value will be returned
+ @transient private lazy val nullRow: Seq[InternalRow] =
+ new GenericInternalRow(Array.ofDim[Any](fieldsLength)) :: Nil
+
+ private def parseRow(parser: JsonParser, fieldNames: Seq[String]):
Seq[InternalRow] = {
+ // only objects are supported
+ if (parser.nextToken() != JsonToken.START_OBJECT) return nullRow
+
+ val row = Array.ofDim[Any](fieldNames.length)
+
+ // start reading through the token stream, looking for any requested field
names
Review Comment:
These are great implementation comments! Could we please update them all to
start with capital letters and end with punctuation (here and everywhere else
in the PR)?
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/json/JsonExpressionEvalUtils.scala:
##########
@@ -159,3 +160,90 @@ case class StructsToJsonEvaluator(
converter(value)
}
}
+
+case class JsonTupleEvaluator(fieldsLength: Int) {
Review Comment:
please add a high level comment saying what this object represents, who
invokes it, and when?
--
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]