Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when querying a field with hyphen #1165

Closed
ardlema opened this issue Apr 18, 2018 · 10 comments
Closed

Error when querying a field with hyphen #1165

ardlema opened this issue Apr 18, 2018 · 10 comments

Comments

@ardlema
Copy link

ardlema commented Apr 18, 2018

Fields with a hyphen prevent the queries from being executed. See below the output of the describe stream command:

ksql> describe sales;
Field           | Type                      
---------------------------------------------
 ROWTIME         | BIGINT           (system) 
 ROWKEY          | VARCHAR(STRING)  (system) 
 fecha-venta     | VARCHAR(STRING)           
 CANTIDAD        | DOUBLE                    
 CENTROCOMERCIAL | VARCHAR(STRING)           
---------------------------------------------
For runtime statistics and query details run: DESCRIBE EXTENDED <Stream,Table>;

And the output of the SELECT * from this stream:

ksql> select * from sales;
Code generation failed for SelectValueMapper
Caused by: Line 1, Column 12: Expression "SALES_fecha" is not an rvalue
@apurvam
Copy link
Contributor

apurvam commented Apr 18, 2018

Which version of KSQL? Are you using Avro ?

@ardlema
Copy link
Author

ardlema commented Apr 19, 2018

Than you for replying @apurvam : KSQL version 0.4 and I'm not using Avro.

@apurvam
Copy link
Contributor

apurvam commented Apr 20, 2018

Can you share the statement where you created your stream/table called sales?

@apurvam
Copy link
Contributor

apurvam commented Apr 20, 2018

Basically, I tried creating a stream like the following: CREATE STREAM TEST (ID bigint, NAME varchar, VALUE double, foo-dash VARCHAR) WITH (kafka_topic='test_topic', value_format='DELIMITED', key='ID'); and that statement itself failed to parse because of the hyphen. So I am not sure how you managed to create a stream with a hyphen in one of the fields.

@ardlema
Copy link
Author

ardlema commented Apr 20, 2018

As per this issue: #769 I've created the stream using backticks, see following the statement:

CREATE STREAM test(`fecha-venta` varchar as fecha, cantidad double, centrocomercial varchar) WITH (kafka_topic='ventas-centro-comercial', value_format='JSON');

@Sebastien-GCN
Copy link

Sebastien-GCN commented Jun 22, 2018

Same issue here.
We're able to create stream with either :

 CREATE STREAM myFirstKSQLStream ( `creation-time` BIGINT ) WITH (kafka_topic='my.topic' , value_format='JSON'); 

or even

CREATE STREAM myFirstKSQLStream ( "creation-time" BIGINT ) WITH (kafka_topic='my.topic' , value_format='JSON');

describe is working properly

 Name                 : MYFIRSTKSQLSTREAM
  Field                              | Type
 ----------------------------------------------------------------
  ROWTIME                            | BIGINT           (system)
  ROWKEY                             | VARCHAR(STRING)  (system)
 creation-time                       | BIGINT
 ----------------------------------------------------------------
 For runtime statistics and query details run: DESCRIBE EXTENDED <Stream,Table>;

However, the select fails.

@megaqube
Copy link

Would be nice if there is a workaround for fix. Exact same problem here.

@Sebastien-GCN
Copy link

No workaround ?

@OneCricketeer
Copy link

Copying another instance of the problem from Stackoverflow for documentation.

https://stackoverflow.com/q/53124857/2308683

@agavra
Copy link
Contributor

agavra commented Oct 16, 2019

Recent work in KSQL has fixed lots of issues, including this one, around quoted identifiers! Master, and subsequently the next release of KSQL, will include this fix:

ksql> CREATE STREAM myFirstKSQLStream ( `creation-time` BIGINT ) WITH (kafka_topic='my.topic' , value_format='JSON', partitions=1);

 Message
----------------
 Stream created
----------------
ksql> INSERT INTO myFirstKSQLStream (`creation-time`) VALUES (123);
ksql> SELECT * FROM myFirstKsqlStream EMIT CHANGES;
+------------------------------+------------------------------+------------------------------+
|ROWTIME                       |ROWKEY                        |creation-time                 |
+------------------------------+------------------------------+------------------------------+
|1571251498560                 |null                          |123                           |

@agavra agavra closed this as completed Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants