Github user lincoln-lil commented on a diff in the pull request:
https://github.com/apache/flink/pull/3829#discussion_r139582270
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/table.scala
---
@@ -762,13 +763,10 @@ class Table(
* @tparam T The data type that the [[TableSink]] expects.
*/
def writeToSink[T](sink: TableSink[T]): Unit = {
-
- def queryConfig = this.tableEnv match {
- case s: StreamTableEnvironment => s.queryConfig
- case b: BatchTableEnvironment => new BatchQueryConfig
- case _ => null
+ val queryConfig = Option(this.tableEnv) match {
--- End diff --
I did think so but encounter a NPE when test
`CorrelateValidationTest.testInvalidTableFunction`
```
// table function call writeToSink
expectExceptionThrown(
func1('c).writeToSink(null),
"Cannot translate a query with an unbounded table function call."
)
```
so I add the `Option` here.
---