fhueske commented on a change in pull request #6508: [Flink-10079] [table] 
Support external sink table in the INSERT INTO clause 
URL: https://github.com/apache/flink/pull/6508#discussion_r218205252
 
 

 ##########
 File path: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/TableEnvironment.scala
 ##########
 @@ -828,12 +831,28 @@ abstract class TableEnvironment(val config: TableConfig) 
{
     rootSchema.getTableNames.contains(name)
   }
 
-  protected def getTable(name: String): org.apache.calcite.schema.Table = {
-    rootSchema.getTable(name)
-  }
+  /**
+    * Get a table from either internal or external catalogs.
+    *
+    * @param name The name of the table.
+    * @return The table registered either internally or externally, None 
otherwise.
+    */
+  protected def getTable(name: String): 
Option[org.apache.calcite.schema.Table] = {
+    val internalTable = rootSchema.getTable(name)
 
-  protected def getRowType(name: String): RelDataType = {
-    rootSchema.getTable(name).getRowType(typeFactory)
+    if (internalTable != null) {
+      Some(internalTable)
+    } else {
+      // search external catalogs
+      var (subSchema, tableName) = (rootSchema, name)
 
 Review comment:
   We can use `val` and a recursive internal function to avoid the `var`

----------------------------------------------------------------
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