Optimizing the Performance of the SPLIT_INDEX Function in Flink SQL
Scenario
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.
Usage
You can use either of the following methods to set table.optimizing.split-index-optimization to true to enable the SPLIT_INDEX function performance optimization:
- Method 1: When configuring a Flink job, add this custom parameter to the flink_config parameter of the job.
- Method 2: Add this custom parameter to the Flink parameters of the endpoint.
SQL Example
CREATE TABLE datagen (
auction BIGINT,
bidder BIGINT,
price BIGINT,
channel VARCHAR,
url VARCHAR
)
WITH
('connector' = 'datagen');
CREATE TABLE blackhole (
auction BIGINT,
bidder BIGINT,
price BIGINT,
channel VARCHAR,
dir1 VARCHAR,
dir2 VARCHAR,
dir3 VARCHAR
)
WITH
('connector' = 'blackhole');
INSERT INTO
blackhole
SELECT
auction,
bidder,
price,
channel,
SPLIT_INDEX (url, '/', 3) as dir1,
SPLIT_INDEX (url, '/', 4) as dir2,
SPLIT_INDEX (url, '/', 5) as dir3
FROM
datagen; 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