md1980
md1980

Reputation: 339

Why does Flink throw parser error when adding additional elements to JSON_OBJECT?

I am trying to create a VIEW on table

CREATE TEMPORARY VIEW `transform_3` AS
SELECT
    `first_name`            AS `first_name`,
    `id`                    AS `id`,
    `event_time`            AS `event_time`,
    3                       AS `ruleId`,
    JSON_OBJECT(
        KEY 'ruleId' VALUE 3,
        KEY 'ruleState' VALUE 'ACTIVE',
        KEY 'groupingKeyNames' VALUE JSON_ARRAY('beneficiaryId'),
        KEY 'unique' VALUE CAST(NULL AS STRING) NULL ON NULL, 
        KEY 'aggregateFieldName' VALUE 'paymentAmount'
    ) AS `violatedRule`
FROM `mdtest`;

I get a parser error when i add the last element 'aggregateFieldName'

[ERROR] Could not execute SQL statement. Reason:
org.apache.flink.sql.parser.impl.ParseException: Encountered "," at line 8, column 179.
Was expecting: 
    ")" ...

Upvotes: 0

Views: 11

Answers (0)

Related Questions