Help Center/ AI DataLake/ Flink reference/ Enhanced Flink Features/ Optimizing FlinkSQL JSON_VALUE Performance
Updated on 2026-11-06 GMT+08:00

Optimizing FlinkSQL JSON_VALUE Performance

Scenario

When the built-in JSON_VALUE function parses multiple fields of a JSON item, the parsing result of the previous JSON item is reused to improve the performance.

Usage

When the built-in SPLIT_INDEX function of FlinkSQL is used to parse multiple fields of a string, enabling the SPLIT_INDEX function performance optimization allows the parsing result of the last split to be reused when parsing multiple fields of the same string, thereby improving computing performance.

SQL Example

CREATE TABLE kafkaSource (
    msgValue STRING
) with (
    'connector' = 'kafka'
    ,'topic' = 'topic-1'
    ,'properties.bootstrap.servers' ='Service IP address of the Kafka Broker instance:Kafka port'
    ,'properties.group.id' = 'group-1'
    ,'value.format' = 'raw'
    ,'scan.startup.mode' = 'group-offsets'
    ,'properties.auto.offset.reset' = 'earliest'
    ,'value.fields-include' = 'EXCEPT_KEY'
);
CREATE TABLE print (
    id STRING,
    name STRING
) with (
      'connector' = 'print'
);
INSERT INTO print
SELECT
    JSON_VAL(msgValue, '$.id'),
    JSON_VAL(msgValue, '$.name')
from kafkaSource;