JsonToStructs¶
JsonToStructs
is a UnaryExpression with timezone support and CodegenFallback.
ExpectsInputTypes¶
JsonToStructs
is an ExpectsInputTypes expression.
Creating Instance¶
JsonToStructs
takes the following to be created:
- DataType
- Options
- Child Expression
- (optional) Time Zone ID
from_json Standard Function¶
JsonToStructs
represents from_json function.
import org.apache.spark.sql.functions.from_json
val jsonCol = from_json($"json", new StructType())
import org.apache.spark.sql.catalyst.expressions.JsonToStructs
val jsonExpr = jsonCol.expr.asInstanceOf[JsonToStructs]
scala> println(jsonExpr.numberedTreeString)
00 jsontostructs('json, None)
01 +- 'json
FAILFAST¶
JsonToStructs
uses JacksonParser in FAILFAST
mode that fails early when a corrupted/malformed record is found (and hence does not support columnNameOfCorruptRecord
JSON option).