关注 spark技术分享,
撸spark源码 玩spark最佳实践

JsonToStructs

JsonToStructs Unary Expression

JsonToStructs is a unary expression with timezone support and CodegenFallback.

JsonToStructs is created to represent from_json function.

JsonToStructs is a ExpectsInputTypes expression.

Note

JsonToStructs uses JacksonParser in FAILFAST mode that simply fails early when a corrupted/malformed record is found (and hence does not support columnNameOfCorruptRecord JSON option).

Table 1. JsonToStructs’s Properties
Property Description

converter

Function that converts Seq[InternalRow] into…​FIXME

nullable

Enabled (i.e. true)

parser

JacksonParser with rowSchema and JSON options

Note
JSON options are made up of the input options with mode option as FAILFAST and the input time zone as the default time zone.

rowSchema

StructType that…​FIXME

  • schema when of type StructType

  • StructType of the elements in schema when of type ArrayType

Creating JsonToStructs Instance

JsonToStructs takes the following when created:

JsonToStructs initializes the internal registries and counters.

Parsing Table Schema for String Literals — validateSchemaLiteral Method

validateSchemaLiteral requests CatalystSqlParser to parseTableSchema for Literal of StringType.

For any other non-StringType types, validateSchemaLiteral reports a AnalysisException:

赞(0) 打赏
未经允许不得转载:spark技术分享 » JsonToStructs
分享到: 更多 (0)

关注公众号:spark技术分享

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏