flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-3639) Add methods and utilities to register DataSets and Tables in the TableEnvironment
Date Wed, 23 Mar 2016 14:57:25 GMT

    [ https://issues.apache.org/jira/browse/FLINK-3639?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15208533#comment-15208533
] 

ASF GitHub Bot commented on FLINK-3639:
---------------------------------------

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

    https://github.com/apache/flink/pull/1827#discussion_r57173349
  
    --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/AbstractTableEnvironment.scala
---
    @@ -0,0 +1,86 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.flink.api.table
    +
    +import org.apache.flink.api.java.DataSet
    +import org.apache.flink.api.table.expressions.Expression
    +import org.apache.flink.api.table.plan.TranslationContext
    +import org.apache.flink.api.table.plan.schema.{DataSetTable, TableTable}
    +
    +class AbstractTableEnvironment {
    +
    +  private[flink] val config = new TableConfig()
    +
    +  /**
    +   * Returns the table config to define the runtime behavior of the Table API.
    +   */
    +  def getConfig = config
    +
    +  /**
    +   * Registers a Table under a unique name, so that it can be used in SQL queries.
    +   * @param name the Table name
    +   * @param table the Table to register
    +   */
    +  def registerTable[T](name: String, table: Table): Unit = {
    +    val tableTable = new TableTable(table.getRelNode())
    +    TranslationContext.registerTable(tableTable, name)
    +  }
    +
    +  /**
    +   * Retrieve a registered Table.
    +   * @param tableName the name under which the Table has been registered
    +   * @return the Table object
    +   */
    +  @throws[TableException]
    +  def scan(tableName: String): Table = {
    +    if (TranslationContext.isRegistered(tableName)) {
    +      val relBuilder = TranslationContext.getRelBuilder
    +      relBuilder.scan(tableName)
    +      new Table(relBuilder.build(), relBuilder)
    +    }
    +    else {
    +      throw new TableException(s"Table \'$tableName\' was not found in the registry.")
    +    }
    +  }
    +
    +  def registerUniqueNameDataSet[T](name: String, dataset: DataSet[T]): Unit = {
    --- End diff --
    
    call this `registerDataSetInternal` and make it private?


> Add methods and utilities to register DataSets and Tables in the TableEnvironment
> ---------------------------------------------------------------------------------
>
>                 Key: FLINK-3639
>                 URL: https://issues.apache.org/jira/browse/FLINK-3639
>             Project: Flink
>          Issue Type: New Feature
>          Components: Table API
>    Affects Versions: 1.1.0
>            Reporter: Vasia Kalavri
>            Assignee: Vasia Kalavri
>
> In order to make tables queryable from SQL we need to register them under a unique name
in the TableEnvironment.
> [This design document|https://docs.google.com/document/d/1sITIShmJMGegzAjGqFuwiN_iw1urwykKsLiacokxSw0/edit]
describes the proposed API.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message