flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lincoln-lil <...@git.apache.org>
Subject [GitHub] flink issue #3829: [FLINK-6442] [table] Extend TableAPI Support Sink Table R...
Date Tue, 25 Jul 2017 07:45:27 GMT
Github user lincoln-lil commented on the issue:

    @fhueske Agree with you. I've done most of the work, but after I deprecated `tableEnv.sql`
method and modify all the relevant test cases, 
    I found a problem when validate input `sql String` in the `sqlSelect` method , we need
to enumerate all kinds of `SqlNode` except `SqlDelete / SqlInsert` and `dml Sql Operations`,
because it's not a `SqlSelect` for such a query `select * from A union select * from B`.
    Did we provide too many types of sql method ?
    And I had a look at the `Jdbc` api, it provided the following sql execution methods( see
    - `Boolean execute ()` Executes the SQL statement in this PreparedStatement object, which
may be any kind of SQL statement.
    - `ResultSet executeQuery ()` Executes the SQL query in this PreparedStatement object
and returns the ResultSet object generated by the query.
    - `int executeUpdate ()` Executes the SQL statement in this PreparedStatement object,
which must be an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or
DELETE; or an SQL statement that returns nothing, such as a DDL statement.
    Since `Jdbc` is well known to most Java developers, I think it's a good reference to our
api design. 
    I propose to provide the corresponding  three methods:
    - `sql(sql: String): Option[Table]` In this PR keeps current `sql(sql: String): Table`
method deprecated, and will open another jira to implement the new sql method to support any
kinds of sql String(even a mixed string contains several types of sql statements) which will
return the value of Option[Table] or other value (discuss later).
    - `sqlQuery(sql: String): Table` 
    - `sqlUpdate(sql: String): Option[Long]` considering returns the affected row count in
the future which is more meaningful than 'Unit' 
    changing the existing test case from the use of `sql` method to the `sqlQuery` method,
update the document and will explain the relationship with Jdbc methods. 
    What do you think?
    Best, 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 infrastructure@apache.org or file a JIRA ticket
with INFRA.

View raw message