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; What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot