Ksql: Invalid Expression table.ROWTIME when table was created with backticks around name

Created on 21 Nov 2018  路  8Comments  路  Source: confluentinc/ksql

ksql> CREATE TABLE `ks_hgame_projects_n111_table` (userid BIGINT, iscancel INTEGER, tprice DOUBLE, bonus DOUBLE, btimestamp BIGINT, wtimestamp BIGINT, dtimestamp BIGINT, pid BIGINT, lid INTEGER, mid BIGINT, modes INTEGER) WITH (kafka_topic='ks_hgame_projects_n11_stream', KEY='userid', VALUE_FORMAT='JSON');

Message       
---------------
Table created 
---------------
ksql> show tables;

Table Name                   | Kafka Topic                  | Format | Windowed 
---------------------------------------------------------------------------------
ks_hgame_projects_n111_table | ks_hgame_projects_n11_stream | JSON   | false    
---------------------------------------------------------------------------------
ksql> select * from `ks_hgame_projects_n111_table`;
Invalid Expression ks_hgame_projects_n111_table.ROWTIME.
ksql> select p.userid from `ks_hgame_projects_n111_table` p;
1008
6219
6219
^CQuery terminated
ksql> select p.ROWTIME from `ks_hgame_projects_n111_table` p;
1542766804803
^CQuery terminated
ksql> select * from `ks_hgame_projects_n111_table`;
Invalid Expression ks_hgame_projects_n111_table.ROWTIME.
ksql>
bug data-accessibility documentation user-experience

Most helpful comment

Another example of where this bug shows is if the object is in non-uppercase and thus requires quoting to reference:

ksql> DESCRIBE "MixedCaseStream";

Name                 : MixedCaseStream
 Field                    | Type
------------------------------------------------------
 ROWTIME                  | BIGINT           (system)
 ROWKEY                   | VARCHAR(STRING)  (system)
 COL1                     | VARCHAR(STRING)
 lowercase_col1           | VARCHAR(STRING)
 MixedCase_COL1           | VARCHAR(STRING)
 UPPERCASE_COL1           | VARCHAR(STRING)
 NOTQUOTED_MIXEDCASE_COL1 | VARCHAR(STRING)
------------------------------------------------------
For runtime statistics and query details run: DESCRIBE EXTENDED <Stream,Table>;
ksql> SELECT * FROM "MixedCaseStream";
Invalid Expression MixedCaseStream.ROWTIME.
ksql>
ksql> SELECT ROWTIME, COL1 FROM "MixedCaseStream" LIMIT 1;
1548071546868 | null
Limit Reached
Query terminated

All 8 comments

@tkaven : Which version of KSQL are you using?

Also: Can you try the following variant, where the quotes/backticks around the table name are omitted?

-- Try this:
select * from ks_hgame_projects_n111_table;

--- instead of
select * from `ks_hgame_projects_n111_table`;

@tkaven : Which version of KSQL are you using?

Also: Can you try the following variant, where the quotes/backticks around the table name are omitted?

-- Try this:
select * from ks_hgame_projects_n111_table;

--- instead of
select * from `ks_hgame_projects_n111_table`;

i find out, because
i use '`' to create:

CREATE TABLE ks_hgame_projects_n111_table

my version is 5.0.1

@tkaven : I am bit confused now. :-)

Does the variant below work for you or not?

-- Try this:
select * from ks_hgame_projects_n111_table;

@tkaven : I am bit confused now. :-)

Does the variant below work for you or not?

-- Try this:
select * from ks_hgame_projects_n111_table;

hi, select * from ks_hgame_projects_n111_table; not work for me
but if i create use 'CREATE TABLE ks_hgame_projects_n111_table'
it works!

so in create statement do not use ` at name then every thing is ok

@big-andy-coates: Is this something new we need to track on our work on quoted identifiers?

There are at least two things here:

  • CREATE'ing a table/stream with a quoted name should work.

    • This includes the scenario where the quotes aren't needed.

  • SELECT'ing from a table/stream should work with a quoted stream/table name.

    • This includes the scenario where the quotes aren't needed.

@JimGalasyn: We should consider documenting this.

Tracking with internal ticket KSQL-1938.

Another example of where this bug shows is if the object is in non-uppercase and thus requires quoting to reference:

ksql> DESCRIBE "MixedCaseStream";

Name                 : MixedCaseStream
 Field                    | Type
------------------------------------------------------
 ROWTIME                  | BIGINT           (system)
 ROWKEY                   | VARCHAR(STRING)  (system)
 COL1                     | VARCHAR(STRING)
 lowercase_col1           | VARCHAR(STRING)
 MixedCase_COL1           | VARCHAR(STRING)
 UPPERCASE_COL1           | VARCHAR(STRING)
 NOTQUOTED_MIXEDCASE_COL1 | VARCHAR(STRING)
------------------------------------------------------
For runtime statistics and query details run: DESCRIBE EXTENDED <Stream,Table>;
ksql> SELECT * FROM "MixedCaseStream";
Invalid Expression MixedCaseStream.ROWTIME.
ksql>
ksql> SELECT ROWTIME, COL1 FROM "MixedCaseStream" LIMIT 1;
1548071546868 | null
Limit Reached
Query terminated

This should be fixed as of master!

Was this page helpful?
0 / 5 - 0 ratings