confluentinc / ksql

The database purpose-built for stream processing applications.
https://ksqldb.io
Other
114 stars 1.04k forks source link

KSQL 5.4 error says a stream is a table #3523

Closed rmoff closed 4 years ago

rmoff commented 5 years ago

CLI v5.4.0-beta190925193823, Server v5.4.0-beta190925193823

ksql> CREATE STREAM FOO WITH (KAFKA_TOPIC='ratings',VALUE_FORMAT='AVRO');

 Message
----------------
 Stream created
----------------
ksql> SELECT * FROM FOO;
Table 'FOO' is not materialized. KSQL currently only supports static queries on materialized aggregate tables. i.e. those created by a 'CREATE TABLE AS SELECT <fields> FROM <sources> GROUP BY <key>' style statement.
ksql>

The error message says that it's a TABLE, but I've created a STREAM. Also if I need to include EMIT CHANGES then this message should include the explanation as shown in #3521 because this is a statement that worked fine <5.4

rmoff commented 5 years ago

Against another stream I get this instead:

ksql> SELECT * FROM CUSTOMERS_REKEYED;
Missing WHERE clause
Static queries currently require a WHERE clause that:
 - limits the query to a single ROWKEY, e.g. `SELECT * FROM X WHERE ROWKEY=Y;`.

Both objects are STREAMs so why the different error message?

ksql> SHOW STREAMS;

 Stream Name       | Kafka Topic           | Format
----------------------------------------------------
 CUSTOMERS_REKEYED | CUSTOMERS_REKEYED     | AVRO
 CUSTOMERS_STREAM  | asgard.demo.CUSTOMERS | AVRO
 FOO               | ratings               | AVRO
 POOR_RATINGS      | POOR_RATINGS          | AVRO
 RATINGS           | ratings               | AVRO
----------------------------------------------------
ksql> SELECT * FROM FOO;
Table 'FOO' is not materialized. KSQL currently only supports static queries on materialized aggregate tables. i.e. those created by a 'CREATE TABLE AS SELECT <fields> FROM <sources> GROUP BY <key>' style statement.
ksql> SELECT * FROM CUSTOMERS_REKEYED;
Missing WHERE clause
Static queries currently require a WHERE clause that:
 - limits the query to a single ROWKEY, e.g. `SELECT * FROM X WHERE ROWKEY=Y;`.

Same point as above for this different error message (Missing WHERE clause) - include the info about EMIT CHANGES (unless this error shouldn't occur for STREAM queries and is just a bug)

rmoff commented 4 years ago

@big-andy-coates is this in ksqlDB 0.6? I still see the problem, e.g. against a STREAM:

ksql> select * from tweets_03;
Table 'TWEETS_03' is not materialized. Refer to https://cnfl.io/queries for info on query types. If you intended to issue a push query, resub
[…]