flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fhueske <...@git.apache.org>
Subject [GitHub] flink pull request #3829: [FLINK-6442] [table] Extend TableAPI Support Sink ...
Date Mon, 04 Sep 2017 15:56:24 GMT
Github user fhueske commented on a diff in the pull request:

    --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/queryConfig.scala
    @@ -19,9 +19,21 @@
     package org.apache.flink.table.api
     import _root_.java.io.Serializable
     import org.apache.flink.api.common.time.Time
    -class QueryConfig private[table] extends Serializable {}
    +class QueryConfig private[table] extends Serializable {
    +object QueryConfig {
    +  def getQueryConfigFromTableEnv(tableEnv: TableEnvironment): QueryConfig = {
    --- End diff --
    The problem is that we should have the correct subtype of `QueryConfig` (not only the
returned object but also the method signature) and the separation of the stream and batch
APIs. The `StreamExecutionEnvironment.queryConfig` method must be typed to `StreamQueryConfig`
to prevent casting. However, we don't want to have a method that is typed to `StreamQueryConfig`
in the base class `TableEnvironment` because 1) this class should be independent from the
streaming API and 2) we don't want a streaming method in the `BatchTableEnvironment`.
    So, we can add a method to `TableEnvironment` that returns `QueryConfig` (depending on
its own type a `StreamQueryConfig` or `BatchQueryConfig`) and override this method in `StreamTableEnvironment`
such that it returns a `StreamQueryConfig` (and if later necessary in `BatchTableEnvironment`
to return a `BatchQueryConfig`).
    The duplicated code are < 5 lines and we have correct types everywhere. 


View raw message