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

    https://github.com/apache/flink/pull/1827#discussion_r57178675
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/plan/TranslationContext.scala
 ---
    @@ -59,29 +64,48 @@ object TranslationContext {
           .traitDefs(ConventionTraitDef.INSTANCE)
           .build
     
    -    tabNames = Map[AbstractTable, String]()
    -
    +    tablesRegistry = Map[String, AbstractTable]()
         relBuilder = RelBuilder.create(frameworkConfig)
    -
         nameCntr.set(0)
     
       }
     
    +  /**
    +   * Adds a table to the Calcite schema so it can be used by the Table API
    +   */
       def addDataSet(newTable: DataSetTable[_]): String = {
    +    val tabName = "DataSetTable_" + nameCntr.getAndIncrement()
    +    tables.add(tabName, newTable)
    +    tabName
    +  }
    +
    +  /**
    +   * Adds a table to the Calcite schema and the tables registry,
    +   * so it can be used by both Table API and SQL statements.
    +   */
    +  @throws[TableException]
    +  def registerTable(table: AbstractTable, name: String): Unit = {
     
    -    // look up name
    -    val tabName = tabNames.get(newTable)
    +    val existingTable = tablesRegistry.get(name)
    --- End diff --
    
    Should we check that the name does not follow the pattern 
`DataSetTable_[0-9]+`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to