写入多个Sink语句时,需要以BEGIN STATEMENT SET;开头,以END;结尾。
CREATE TEMPORARY TABLE datagen_source (
name VARCHAR,
score BIGINT
) WITH (
'connector' = 'datagen'
);
CREATE TEMPORARY TABLE blackhole_sinkA(
name VARCHAR,
score BIGINT
) WITH (
'connector' = 'blackhole'
);
CREATE TEMPORARY TABLE blackhole_sinkB(
name VARCHAR,
score BIGINT
) WITH (
'connector' = 'blackhole'
);
BEGIN STATEMENT SET;
INSERT INTO blackhole_sinkA
SELECT UPPER(name), sum(score)
FROM datagen_source
GROUP BY UPPER(name);
INSERT INTO blackhole_sinkB
SELECT LOWER(name), max(score)
FROM datagen_source
GROUP BY LOWER(name);
END;