[
https://issues.apache.org/jira/browse/FLINK-23933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17419255#comment-17419255
]
Francesco Guardiani edited comment on FLINK-23933 at 9/23/21, 2:38 PM:
-----------------------------------------------------------------------
I think that's the point of the issue: specify the schema via json queries,
while leveraging the rest of the json format options. e.g.
{code:java}
CREATE TABLE input(
a AS JSON_QUERY('$.my.nested.data.structure', TIMESTAMP(3))
)
WITH (
'format' = 'json',
'json.timestamp-format.standard' = 'ISO-8601'
);
{code}
(the usage of JSON_QUERY here is wrong, but you get the point)
Does it makes sense?
was (Author: slinkydeveloper):
I think that's the point of the issue: specify the schema via json query, while
leveraging the rest of the json format options. e.g.
{code:java}
CREATE TABLE input(
a AS JSON_QUERY('$.my.nested.data.structure', TIMESTAMP(3))
)
WITH (
'format' = 'json',
'json.timestamp-format.standard' = 'ISO-8601'
);
{code}
(the usage of JSON_QUERY here is wrong, but you get the point)
Does it makes sense?
> flink-json formats support a option to parse nested json as a String
> --------------------------------------------------------------------
>
> Key: FLINK-23933
> URL: https://issues.apache.org/jira/browse/FLINK-23933
> Project: Flink
> Issue Type: Improvement
> Components: Formats (JSON, Avro, Parquet, ORC, SequenceFile)
> Affects Versions: 1.13.2
> Reporter: Shengnan YU
> Priority: Major
>
> When use Flink SQL to read message with nested json, eg. \{"a":{"b":111,
> "c":"xxx"}, "d":12345},The nested field must be specified ROW or MAP in the
> table schema.
> {code:sql}
> CREATE TABLE input(
> a ROW(`b`: BIGINT, `c` VARCHAR),
> d BIGINT
> )
> WITH (
> 'format' = 'json',
> // ...
> );
> {code}
> I'd like to create a option to allow we read the json-object type value as a
> String.
> {code:sql}
> CREATE TABLE input (
> a VARCHAR,
> d VARCHAR
> )
> WITH (
> 'format' = 'json',
> 'json.forceStringFields' = 'a,d'
> // ...
> );
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)