Github user lincoln-lil commented on the issue:

    https://github.com/apache/flink/pull/3829
  
    @fhueske, thanks for reviewing this. I read the design doc again, the 
original idea to support this functionality was doing minimal changes in the 
current state.  
    Yes, currently a TableSink's schema is always derived from the query 
result, and before it is configured the schema is null. Practically, I found 
that we can overwrite the getOutputType method to declare a concrete sink 
table's schema, and this can be used in a dml sql validation.
     So without adding an new SinkTable or modifying TableSink interface, we 
can choose keeping  writeToSink() method in TableAPI as a usage of derive table 
and tell users they can implement a custom type TableSink with output type 
declaration as a predefined schema.
    I'm not sure if we should add a new method like 'sqlInsert' for dml insert 
sql, and uncertain about the return type of an insert Operatoin in 
Flink(Calcite's TableModify defines output for DML(INSERT,DELETE,UPDATE) is a 
RowCount column of BigInt type). I'll discuss this with @shaoxuan-wang @wuchong 
and @sunjincheng121 offline.
    After that I'll update this PR according to your comments.
    Thanks, Lincoln



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to