张超明 created FLINK-22427:
---------------------------

             Summary: Support default value option to simplify data clean 
process
                 Key: FLINK-22427
                 URL: https://issues.apache.org/jira/browse/FLINK-22427
             Project: Flink
          Issue Type: New Feature
          Components: Table SQL / Client, Table SQL / Planner
    Affects Versions: 1.11.1
         Environment: Flink version 1.1.1
            Reporter: 张超明


 The SQL statement is designed as below:
{code:sql}
CREATE TABLE user_behavior (
    user_id BIGINT,
    item_id BIGINT,
    category_id BIGINT,
    behavior STRING default 'soo', ---- Here I wanna use default value
) WITH (
    'connector' = 'kafka', 
    'topic' = 'user_behavior',
    'scan.startup.mode' = 'earliest-offset',
    'properties.bootstrap.servers' = 'kafka:9094'
    'format' = 'json'
);
{code}
 Throws Exception:
{code:java}
[ERROR] Could not execute SQL statement. Reason:
        org.apache.flink.sql.parser.impl.ParseException: Encountered "default" 
at line 5, column 21.
        Was expecting one of:
            "CONSTRAINT" ...
{code}
 It's more friendly for us to support that allowing users to set default value 
during table schema definition. That will reduce UDXF usage and simplify data 
clean process to some extent.

There are two points need to be solved:
 * Support SQL grammar.
 * Set field to specified value while field value is missing.

 

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to