You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/06/30 16:35:00 UTC

[jira] [Commented] (BEAM-2528) BeamSql: support create table

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

ASF GitHub Bot commented on BEAM-2528:
--------------------------------------

GitHub user xumingming opened a pull request:

    https://github.com/apache/beam/pull/3481

    [BEAM-2528] BeamSql: DDL: create table

    I started this PR as an initial attempt to implement the `create table` statement.  The implementation might not be so mature, but I hope this could be a place we can discuss deeper about the create table. I will introduce this PR in the following 3 aspects:
    
    * MetaStore
    * TableProvider
    * Grammar
    
    ## MetaStore
    
    Metastore is responsible for handling the CRUD of table during a session. e.g. create a table, query all tables, query a table by the specified name etc. When a table is created, the table meta info can be persisted by the metastore, but the default `InMemoryMetaStore` will only store the meta info in memory, so it will NOT be persisted, but user can implement the `MetaStore` interface to make a persistent implementation.
    
    The table names in MetaStore need to be unique.
    
    ## TableProvider
    
    The tables in MetaStore can come from many different sources, the construction of a usable table is the responsibility of a `TableProvider`, TableProvider have the similar interface like `MetaStore`, but it only handles a specific type of table, e.g. `TextTableProvider` only handle text tables, while `KafakaTableProvider` only handle kafka tables.
    
    ## Grammar
    
    The grammar for create table is:
    
    ```sql
    CREATE TABLE ORDERS(
       ID INT PRIMARY KEY COMMENT 'this is the primary key',
       NAME VARCHAR(127) COMMENT 'this is the name'
    )
    COMMENT 'this is the table orders'
    LOCATION 'text://home/admin/orders'
    TBLPROPERTIES '{"format": "Excel"}'
    ```
    
    `LOCATION` dictates where the data of the table is stored. The scheme of the LOCATION dictate the table type, e.g. in the above example, the table type is `text`, using the table type we can find the corresponding `TextTableProvider` using the ServiceLoader merchanism.
    
    `TBLPROPERTIES` is used to specify some other properties of the table, in the above example, we specified the format of each line of text file: `Excel`(one variant of CSV format).

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/xumingming/beam BEAM-2528-create-table

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/beam/pull/3481.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #3481
    
----
commit 9bbb08f5bdabbb903491c9ec0bfc32145632d63b
Author: James Xu <xu...@gmail.com>
Date:   2017-06-17T11:30:03Z

    [BEAM-2528] BeamSql: DDL: create table

----


> BeamSql: support create table
> -----------------------------
>
>                 Key: BEAM-2528
>                 URL: https://issues.apache.org/jira/browse/BEAM-2528
>             Project: Beam
>          Issue Type: Sub-task
>          Components: dsl-sql
>            Reporter: James Xu
>            Assignee: James Xu
>
> support create table.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)