Closed xmlking closed 3 days ago
Discussed in Discord, but for posterity, there is a missing SELECT on line 25. Here's the corrected query:
CREATE TABLE mastodon (
id TEXT,
uri TEXT,
content TEXT
) WITH (
connector = 'sse',
format = 'json',
endpoint = 'http://mastodon.arroyo.dev/api/v1/streaming/public',
events = 'update'
);
CREATE TABLE output_table
WITH (
connector = 'blackhole'
);
INSERT INTO output_table
WITH post_filtering AS (
SELECT
id
, arrow_cast(REGEXP_LIKE(content, '(kamala|har{1,3}is)', 'i'), 'Int64') AS harris_mentioned
, arrow_cast(REGEXP_LIKE(content, 'trumps?', 'i'), 'Int64') AS trump_mentioned
FROM mastodon
)
SELECT
TUMBLE(interval '30 seconds') AS window
, SUM(harris_mentioned) AS number_of_post_mention_harris
, SUM(trump_mentioned) AS number_of_post_mention_trump
FROM post_filtering
GROUP BY window
why I am getting syntax error with this?
https://github.com/ducthuy-ng/bigdata-sem241/blob/main/pipeline.arroyo.sql