Github user MaxGekk commented on a diff in the pull request:
https://github.com/apache/spark/pull/22237#discussion_r224042251
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/jsonExpressions.scala
---
@@ -554,18 +554,30 @@ case class JsonToStructs(
@transient
lazy val converter = nullableSchema match {
case _: StructType =>
- (rows: Seq[InternalRow]) => if (rows.length == 1) rows.head else null
+ (rows: Iterator[InternalRow]) => if (rows.hasNext) rows.next() else
null
--- End diff --
> we don't have to do it in this PR, but it would be great to document when
this expression will return null ...
We already state in the docs for `from_json()`: `Returns null, in the case
of an unparseable string.`
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]