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

Add column name quotes using back tick (`) #19

Open
gliter opened this issue Nov 25, 2022 · 1 comment
Open

Add column name quotes using back tick (`) #19

gliter opened this issue Nov 25, 2022 · 1 comment

Comments

@gliter
Copy link
Collaborator

gliter commented Nov 25, 2022

Without backticks quotation Flink will try to interprete column names as key words, example given when column name is "timestamp" it will fail.

Flink SQL> create table clickstream (timestamp DECIMAL,user_id DECIMAL,balance DECIMAL,load_balance DECIMAL,event STRING) with (
>        'connector' = 'kafka',
>        'properties.bootstrap.servers' = 'kafka:29092',
>        'topic' = 'clickstream',
>        'value.format' = 'json',
>        'properties.group.id' = 'dbt-seed',
>        'value.json.encode.decimal-as-plain-number' = 'true'
>       
>     )
> 
> ;
[ERROR] Could not execute SQL statement. Reason:
org.apache.flink.sql.parser.impl.ParseException: Encountered "timestamp" at line 1, column 27.
Was expecting one of:
    "CONSTRAINT" ...
    "PRIMARY" ...
    "UNIQUE" ...
    "WATERMARK" ...
    <BRACKET_QUOTED_IDENTIFIER> ...
    <QUOTED_IDENTIFIER> ...
    <BACK_QUOTED_IDENTIFIER> ...
    <HYPHENATED_IDENTIFIER> ...
    <IDENTIFIER> ...
    <UNICODE_QUOTED_IDENTIFIER> ...
    

Flink SQL> create table clickstream (`timestamp` DECIMAL,user_id DECIMAL,balance DECIMAL,load_balance DECIMAL,event STRING) with (
>        'connector' = 'kafka',
>        'properties.bootstrap.servers' = 'kafka:29092',
>        'topic' = 'clickstream',
>        'value.format' = 'json',
>        'properties.group.id' = 'dbt-seed',
>        'value.json.encode.decimal-as-plain-number' = 'true'
>       
>     )
> ;
[INFO] Execute statement succeed.
@gliter
Copy link
Collaborator Author

gliter commented Nov 28, 2022

I see that we have sometimes quotes inside macros and sometimes are taken from function that uses QuotePolicy. We should make approach uniform across all places.

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

1 participant