You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by xumingming <gi...@git.apache.org> on 2017/06/30 16:34:53 UTC

[GitHub] beam pull request #3481: [BEAM-2528] BeamSql: DDL: create table

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

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] beam pull request #3481: [BEAM-2528] BeamSql: DDL: create table

Posted by xumingming <gi...@git.apache.org>.
Github user xumingming closed the pull request at:

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


---