pnowojski commented on a change in pull request #6787: [FLINK-8577][table] 
Implement proctime DataStream to Table upsert conversion
URL: https://github.com/apache/flink/pull/6787#discussion_r237018239
 
 

 ##########
 File path: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/rules/datastream/DataStreamScanRule.scala
 ##########
 @@ -36,25 +36,32 @@ class DataStreamScanRule
 
   override def matches(call: RelOptRuleCall): Boolean = {
     val scan: FlinkLogicalNativeTableScan = 
call.rel(0).asInstanceOf[FlinkLogicalNativeTableScan]
-    val dataSetTable = scan.getTable.unwrap(classOf[DataStreamTable[Any]])
-    dataSetTable match {
-      case _: DataStreamTable[Any] =>
-        true
-      case _ =>
-        false
-    }
+    val appendTable = scan.getTable.unwrap(classOf[AppendStreamTable[Any]])
+    val upsertTable = scan.getTable.unwrap(classOf[UpsertStreamTable[Any]])
+
+    appendTable != null || upsertTable != null
 
 Review comment:
   can we avoid those nulls (in multiple places)? For example by using 
`isInstanceOf` or match? Handling null is dangerous and error prone.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to