Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3829#discussion_r136847905
  
    --- 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. 


---

Reply via email to