kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marina Popova <ppin...@protonmail.com.INVALID>
Subject KSQL CLI: cannot execute script with SELECT query (but can execute other scripts)
Date Tue, 07 May 2019 14:58:36 GMT
Hi, one more question on KSQL CLI:
using "run script /myScript.ksql" commands I can run scripts with "CREATE STREAM ..." and
"CREATE TABLE ..." commands - no problem.

However, when I try to run a script with a SELECT statement, I'm getting an error:

Script: top3_reqtime.ksql
SELECT payload->sitekey,
      windowStart() as window_start,
      windowEnd() as window_end,
      TOPK(request_time, 3) as top_3_request_times
FROM rc_events_full
WINDOW TUMBLING (SIZE 30 SECONDS)
GROUP BY payload->sitekey;

Results from CLI:

ksql> run script /ksql-scripts/top3_reqtime.ksql;

SELECT and PRINT queries must use the /query endpoint

ksql>

If I run the same query directly from the CLI - it works just fine:

ksql> SELECT payload->sitekey,

>      windowStart() as window_start,

>      windowEnd() as window_end,

>      TOPK(request_time, 3) as top_3_request_times

>FROM rc_events_full

>WINDOW TUMBLING (SIZE 30 SECONDS)

>GROUP BY payload->sitekey;

       8vGuAWfMScPzFg | 1557193020000 | 1557193050000 | [0.014]

       8vGuAWfMScPzFg | 1557193050000 | 1557193080000 | [0.062]

Why can't I execute this query from a script?
Thank you!
Marina

Sent with [ProtonMail](https://protonmail.com) Secure Email.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message