[GitHub] carbondata pull request #1258: [CARBONDATA-1325] Add partition guidance doc

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1258: [CARBONDATA-1325] Add partition guidance doc

qiuchenjian-2
GitHub user lionelcao opened a pull request:

    https://github.com/apache/carbondata/pull/1258

    [CARBONDATA-1325] Add partition guidance doc

   

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

    $ git pull https://github.com/lionelcao/carbondata carbon_910_016

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

    https://github.com/apache/carbondata/pull/1258.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 #1258
   
----
commit 4106881b361350aece8a01e6f848f09a92fc030e
Author: lionelcao <[hidden email]>
Date:   2017-08-15T10:26:42Z

    add partition guidance doc

----


---
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 [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #1258: [CARBONDATA-1325] Add partition guidance doc

qiuchenjian-2
Github user asfgit commented on the issue:

    https://github.com/apache/carbondata/pull/1258
 
    SUCCESS
     
    --none--


---
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 [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #1258: [CARBONDATA-1325] Add partition guidance doc

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user chenliang613 commented on the issue:

    https://github.com/apache/carbondata/pull/1258
 
    retest this please


---
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 [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #1258: [CARBONDATA-1325] Add partition guidance doc

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user chenliang613 commented on the issue:

    https://github.com/apache/carbondata/pull/1258
 
    retest this please


---
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 [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #1258: [CARBONDATA-1325] Add partition guidance doc

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user chenliang613 commented on the issue:

    https://github.com/apache/carbondata/pull/1258
 
    retest this please


---
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 [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #1258: [CARBONDATA-1325] Add partition guidance doc

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user chenliang613 commented on the issue:

    https://github.com/apache/carbondata/pull/1258
 
    retest this please


---
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 [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1258: [CARBONDATA-1325] Add partition guidance doc

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user chenliang613 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1258#discussion_r133453134
 
    --- Diff: docs/partition-guide.md ---
    @@ -0,0 +1,124 @@
    +<!--
    +    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.
    +-->
    +
    +### CarbonData Partition Table Guidance
    +This guidance illustrates how to create & use partition table in CarbonData.
    +
    +* [Create Partition Table](#create-partition-table)
    +  - [Create Hash Partition Table](#create-hash-partition-table)
    +  - [Create Range Partition Table](#create-range-partition-table)
    +  - [Create List Partition Table](#create-list-partition-table)
    +* [Show Partitions](#show-partitions)
    +* [Maintain the Partitions](#maintain-the-partitions)
    +* [Partition Id](#partition-id)
    +* [Tips](#tips)
    +
    +### Create Partition Table
    +
    +##### Create Hash Partition Table
    +```
    +   CREATE TABLE [IF NOT EXISTS] [db_name.]table_name
    +                    [(col_name data_type , ...)]
    +   STORED BY 'carbondata'
    +   PARTITIONED BY (partition_col_name data_type)
    +   [TBLPROPERTIES ('PARTITION_TYPE'='HASH',
    +                   'PARTITION_NUM'='N' ...)]  
    +   //N is the number of hash partitions
    +```
    --- End diff --
   
    Please provide a specific example


---
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 [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #1258: [CARBONDATA-1325] Add partition guidance doc

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:

    https://github.com/apache/carbondata/pull/1258
 
    SDV Build Success with Spark 2.1, Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/200/



---
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 [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1258: [CARBONDATA-1325] Add partition guidance doc

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user zzcclp commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1258#discussion_r133619148
 
    --- Diff: docs/partition-guide.md ---
    @@ -0,0 +1,124 @@
    +<!--
    +    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.
    +-->
    +
    +### CarbonData Partition Table Guidance
    +This guidance illustrates how to create & use partition table in CarbonData.
    +
    +* [Create Partition Table](#create-partition-table)
    +  - [Create Hash Partition Table](#create-hash-partition-table)
    +  - [Create Range Partition Table](#create-range-partition-table)
    +  - [Create List Partition Table](#create-list-partition-table)
    +* [Show Partitions](#show-partitions)
    +* [Maintain the Partitions](#maintain-the-partitions)
    +* [Partition Id](#partition-id)
    +* [Tips](#tips)
    +
    +### Create Partition Table
    +
    +##### Create Hash Partition Table
    +```
    +   CREATE TABLE [IF NOT EXISTS] [db_name.]table_name
    +                    [(col_name data_type , ...)]
    +   STORED BY 'carbondata'
    +   PARTITIONED BY (partition_col_name data_type)
    --- End diff --
   
    The ‘PARTITIONED BY' must be before 'STORED BY', otherwise it will throw an error:
    `mismatched input 'PARTITIONED' expecting {<EOF>, '(', 'SELECT', 'FROM', 'AS', 'WITH', 'VALUES', 'TABLE', 'INSERT', 'MAP', 'REDUCE', 'TBLPROPERTIES', 'LOCATION'}(line 11, pos 2)`


---
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 [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1258: [CARBONDATA-1325] Add partition guidance doc

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user zzcclp commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1258#discussion_r133619308
 
    --- Diff: docs/partition-guide.md ---
    @@ -0,0 +1,124 @@
    +<!--
    +    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.
    +-->
    +
    +### CarbonData Partition Table Guidance
    +This guidance illustrates how to create & use partition table in CarbonData.
    +
    +* [Create Partition Table](#create-partition-table)
    +  - [Create Hash Partition Table](#create-hash-partition-table)
    +  - [Create Range Partition Table](#create-range-partition-table)
    +  - [Create List Partition Table](#create-list-partition-table)
    +* [Show Partitions](#show-partitions)
    +* [Maintain the Partitions](#maintain-the-partitions)
    +* [Partition Id](#partition-id)
    +* [Tips](#tips)
    +
    +### Create Partition Table
    +
    +##### Create Hash Partition Table
    +```
    +   CREATE TABLE [IF NOT EXISTS] [db_name.]table_name
    +                    [(col_name data_type , ...)]
    +   STORED BY 'carbondata'
    +   PARTITIONED BY (partition_col_name data_type)
    +   [TBLPROPERTIES ('PARTITION_TYPE'='HASH',
    +                   'PARTITION_NUM'='N' ...)]  
    --- End diff --
   
    change  'PARTITION_NUM' to 'NUM_PARTITIONS'


---
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 [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1258: [CARBONDATA-1325] Add partition guidance doc

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user xuchuanyin commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1258#discussion_r133634053
 
    --- Diff: docs/partition-guide.md ---
    @@ -0,0 +1,124 @@
    +<!--
    +    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.
    +-->
    +
    +### CarbonData Partition Table Guidance
    +This guidance illustrates how to create & use partition table in CarbonData.
    +
    +* [Create Partition Table](#create-partition-table)
    +  - [Create Hash Partition Table](#create-hash-partition-table)
    +  - [Create Range Partition Table](#create-range-partition-table)
    +  - [Create List Partition Table](#create-list-partition-table)
    +* [Show Partitions](#show-partitions)
    +* [Maintain the Partitions](#maintain-the-partitions)
    +* [Partition Id](#partition-id)
    +* [Tips](#tips)
    +
    +### Create Partition Table
    +
    +##### Create Hash Partition Table
    +```
    +   CREATE TABLE [IF NOT EXISTS] [db_name.]table_name
    +                    [(col_name data_type , ...)]
    +   STORED BY 'carbondata'
    +   PARTITIONED BY (partition_col_name data_type)
    +   [TBLPROPERTIES ('PARTITION_TYPE'='HASH',
    +                   'PARTITION_NUM'='N' ...)]  
    +   //N is the number of hash partitions
    +```
    +
    +##### Create Range Partition Table
    +```
    +   CREATE TABLE [IF NOT EXISTS] [db_name.]table_name
    +                    [(col_name data_type , ...)]
    +   STORED BY 'carbondata'
    +   PARTITIONED BY (partition_col_name data_type)
    +   [TBLPROPERTIES ('PARTITION_TYPE'='RANGE',
    +                   'RANGE_INFO'='2014-01-01, 2015-01-01, 2016-01-01' ...)]
    +```
    +Notes:
    +1. The 'RANGE_INFO' defined in table properties must be in ascending order.
    +2. If the partition column is Date/Timestamp type, the format could be defined in CarbonProperties. By default it's yyyy-MM-dd.
    +
    +##### Create List Partition Table
    +```
    +   CREATE TABLE [IF NOT EXISTS] [db_name.]table_name
    +                    [(col_name data_type , ...)]
    +   STORED BY 'carbondata'
    +   PARTITIONED BY (partition_col_name data_type)
    +   [TBLPROPERTIES ('PARTITION_TYPE'='LIST',
    +                   'LIST_INFO'='A, B, C' ...)]
    +```
    +Notes:
    +1. List partition support list info in one level group. For example,
    +```
    +   ...
    +   'LIST_INFO' = 'A, B, (C, D), (E, F, G), H'
    +   ...
    +```
    +
    +
    +### Show Partitions
    +Execute following command to get the partition information
    +```
    +   SHOW PARTITIONS [db_name.]table_name
    +
    +```
    +
    +### Maintain the Partitions
    +##### Add a new partition
    +```
    +   ALTER TABLE [db_name].table_name ADD PARTITION('new_partition')
    +```
    +##### Split a partition
    +```
    +   ALTER TABLE [db_name].table_name SPLIT PARTITION(partition_id) INTO('new_partition1', 'new_partition2'...)
    +```
    +##### Drop a partition
    +```
    +   //Drop partition definition only and keep data
    +   ALTER TABLE [db_name].table_name DROP PARTITION(partition_id)
    +  
    +   //Drop both partition definition and data
    +   ALTER TABLE [db_name].table_name DROP PARTITION(partition_id) WITH DATA
    +```
    +Notes:
    +1. For the 1st case(keep data),
    +   * if the table is a range partition table, data will be merged into the later partition, and if the dropped partition is the last one, then data will be merged into default partition.
    --- End diff --
   
    I think `the later partition` => `the next partition` is better


---
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 [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1258: [CARBONDATA-1325] Add partition guidance doc

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user xuchuanyin commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1258#discussion_r133645471
 
    --- Diff: docs/partition-guide.md ---
    @@ -0,0 +1,124 @@
    +<!--
    +    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.
    +-->
    +
    +### CarbonData Partition Table Guidance
    +This guidance illustrates how to create & use partition table in CarbonData.
    +
    +* [Create Partition Table](#create-partition-table)
    +  - [Create Hash Partition Table](#create-hash-partition-table)
    +  - [Create Range Partition Table](#create-range-partition-table)
    +  - [Create List Partition Table](#create-list-partition-table)
    +* [Show Partitions](#show-partitions)
    +* [Maintain the Partitions](#maintain-the-partitions)
    +* [Partition Id](#partition-id)
    +* [Tips](#tips)
    +
    +### Create Partition Table
    +
    +##### Create Hash Partition Table
    +```
    +   CREATE TABLE [IF NOT EXISTS] [db_name.]table_name
    +                    [(col_name data_type , ...)]
    +   STORED BY 'carbondata'
    +   PARTITIONED BY (partition_col_name data_type)
    --- End diff --
   
    Is there any constraint on the datatype?


---
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 [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1258: [CARBONDATA-1325] Add partition guidance doc

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user xuchuanyin commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1258#discussion_r133645214
 
    --- Diff: docs/partition-guide.md ---
    @@ -0,0 +1,124 @@
    +<!--
    +    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.
    +-->
    +
    +### CarbonData Partition Table Guidance
    +This guidance illustrates how to create & use partition table in CarbonData.
    +
    +* [Create Partition Table](#create-partition-table)
    +  - [Create Hash Partition Table](#create-hash-partition-table)
    +  - [Create Range Partition Table](#create-range-partition-table)
    +  - [Create List Partition Table](#create-list-partition-table)
    +* [Show Partitions](#show-partitions)
    +* [Maintain the Partitions](#maintain-the-partitions)
    +* [Partition Id](#partition-id)
    +* [Tips](#tips)
    +
    +### Create Partition Table
    +
    +##### Create Hash Partition Table
    +```
    +   CREATE TABLE [IF NOT EXISTS] [db_name.]table_name
    +                    [(col_name data_type , ...)]
    +   STORED BY 'carbondata'
    +   PARTITIONED BY (partition_col_name data_type)
    +   [TBLPROPERTIES ('PARTITION_TYPE'='HASH',
    +                   'PARTITION_NUM'='N' ...)]  
    +   //N is the number of hash partitions
    +```
    +
    +##### Create Range Partition Table
    +```
    +   CREATE TABLE [IF NOT EXISTS] [db_name.]table_name
    +                    [(col_name data_type , ...)]
    +   STORED BY 'carbondata'
    +   PARTITIONED BY (partition_col_name data_type)
    +   [TBLPROPERTIES ('PARTITION_TYPE'='RANGE',
    +                   'RANGE_INFO'='2014-01-01, 2015-01-01, 2016-01-01' ...)]
    +```
    +Notes:
    +1. The 'RANGE_INFO' defined in table properties must be in ascending order.
    +2. If the partition column is Date/Timestamp type, the format could be defined in CarbonProperties. By default it's yyyy-MM-dd.
    +
    +##### Create List Partition Table
    +```
    +   CREATE TABLE [IF NOT EXISTS] [db_name.]table_name
    +                    [(col_name data_type , ...)]
    +   STORED BY 'carbondata'
    +   PARTITIONED BY (partition_col_name data_type)
    +   [TBLPROPERTIES ('PARTITION_TYPE'='LIST',
    +                   'LIST_INFO'='A, B, C' ...)]
    +```
    +Notes:
    +1. List partition support list info in one level group. For example,
    +```
    +   ...
    +   'LIST_INFO' = 'A, B, (C, D), (E, F, G), H'
    +   ...
    +```
    +
    +
    +### Show Partitions
    +Execute following command to get the partition information
    +```
    +   SHOW PARTITIONS [db_name.]table_name
    +
    +```
    +
    +### Maintain the Partitions
    +##### Add a new partition
    +```
    +   ALTER TABLE [db_name].table_name ADD PARTITION('new_partition')
    +```
    +##### Split a partition
    +```
    +   ALTER TABLE [db_name].table_name SPLIT PARTITION(partition_id) INTO('new_partition1', 'new_partition2'...)
    +```
    +##### Drop a partition
    +```
    +   //Drop partition definition only and keep data
    +   ALTER TABLE [db_name].table_name DROP PARTITION(partition_id)
    +  
    +   //Drop both partition definition and data
    +   ALTER TABLE [db_name].table_name DROP PARTITION(partition_id) WITH DATA
    +```
    +Notes:
    +1. For the 1st case(keep data),
    +   * if the table is a range partition table, data will be merged into the later partition, and if the dropped partition is the last one, then data will be merged into default partition.
    +   * if the table is a list partition table, data will be merged into default partition.
    +2. Drop default partition is not allowed, but you can use DELETE statement to delete data in default partition.
    +3. partition_id could be got from SHOW PARTITIONS command.
    +4. Hash partition table is not supported for the ADD, SPLIT, DROP command.
    +
    +### Partition Id
    +In carbon partition table, we use partition id to replace the task id
    --- End diff --
   
    @lionelcao Can you add a document to explain the partition feature, such as implementation and why implement in this way?


---
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 [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1258: [CARBONDATA-1325] Add partition guidance doc

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user xuchuanyin commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1258#discussion_r133634143
 
    --- Diff: docs/partition-guide.md ---
    @@ -0,0 +1,124 @@
    +<!--
    +    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.
    +-->
    +
    +### CarbonData Partition Table Guidance
    +This guidance illustrates how to create & use partition table in CarbonData.
    +
    +* [Create Partition Table](#create-partition-table)
    +  - [Create Hash Partition Table](#create-hash-partition-table)
    +  - [Create Range Partition Table](#create-range-partition-table)
    +  - [Create List Partition Table](#create-list-partition-table)
    +* [Show Partitions](#show-partitions)
    +* [Maintain the Partitions](#maintain-the-partitions)
    +* [Partition Id](#partition-id)
    +* [Tips](#tips)
    +
    +### Create Partition Table
    +
    +##### Create Hash Partition Table
    +```
    +   CREATE TABLE [IF NOT EXISTS] [db_name.]table_name
    +                    [(col_name data_type , ...)]
    +   STORED BY 'carbondata'
    +   PARTITIONED BY (partition_col_name data_type)
    +   [TBLPROPERTIES ('PARTITION_TYPE'='HASH',
    +                   'PARTITION_NUM'='N' ...)]  
    +   //N is the number of hash partitions
    +```
    +
    +##### Create Range Partition Table
    +```
    +   CREATE TABLE [IF NOT EXISTS] [db_name.]table_name
    +                    [(col_name data_type , ...)]
    +   STORED BY 'carbondata'
    +   PARTITIONED BY (partition_col_name data_type)
    +   [TBLPROPERTIES ('PARTITION_TYPE'='RANGE',
    +                   'RANGE_INFO'='2014-01-01, 2015-01-01, 2016-01-01' ...)]
    +```
    +Notes:
    +1. The 'RANGE_INFO' defined in table properties must be in ascending order.
    +2. If the partition column is Date/Timestamp type, the format could be defined in CarbonProperties. By default it's yyyy-MM-dd.
    +
    +##### Create List Partition Table
    +```
    +   CREATE TABLE [IF NOT EXISTS] [db_name.]table_name
    +                    [(col_name data_type , ...)]
    +   STORED BY 'carbondata'
    +   PARTITIONED BY (partition_col_name data_type)
    +   [TBLPROPERTIES ('PARTITION_TYPE'='LIST',
    +                   'LIST_INFO'='A, B, C' ...)]
    +```
    +Notes:
    +1. List partition support list info in one level group. For example,
    +```
    +   ...
    +   'LIST_INFO' = 'A, B, (C, D), (E, F, G), H'
    +   ...
    +```
    +
    +
    +### Show Partitions
    +Execute following command to get the partition information
    +```
    +   SHOW PARTITIONS [db_name.]table_name
    +
    +```
    +
    +### Maintain the Partitions
    +##### Add a new partition
    +```
    +   ALTER TABLE [db_name].table_name ADD PARTITION('new_partition')
    +```
    +##### Split a partition
    +```
    +   ALTER TABLE [db_name].table_name SPLIT PARTITION(partition_id) INTO('new_partition1', 'new_partition2'...)
    +```
    +##### Drop a partition
    +```
    +   //Drop partition definition only and keep data
    +   ALTER TABLE [db_name].table_name DROP PARTITION(partition_id)
    +  
    +   //Drop both partition definition and data
    +   ALTER TABLE [db_name].table_name DROP PARTITION(partition_id) WITH DATA
    +```
    +Notes:
    +1. For the 1st case(keep data),
    +   * if the table is a range partition table, data will be merged into the later partition, and if the dropped partition is the last one, then data will be merged into default partition.
    +   * if the table is a list partition table, data will be merged into default partition.
    +2. Drop default partition is not allowed, but you can use DELETE statement to delete data in default partition.
    --- End diff --
   
    But where is the DELETE statement?


---
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 [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #1258: [CARBONDATA-1325] Add partition guidance doc

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:

    https://github.com/apache/carbondata/pull/1258
 
    SDV Build Success with Spark 2.1, Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/237/



---
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 [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1258: [CARBONDATA-1325] Add partition guidance doc

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user lionelcao commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1258#discussion_r135380833
 
    --- Diff: docs/partition-guide.md ---
    @@ -0,0 +1,124 @@
    +<!--
    +    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.
    +-->
    +
    +### CarbonData Partition Table Guidance
    +This guidance illustrates how to create & use partition table in CarbonData.
    +
    +* [Create Partition Table](#create-partition-table)
    +  - [Create Hash Partition Table](#create-hash-partition-table)
    +  - [Create Range Partition Table](#create-range-partition-table)
    +  - [Create List Partition Table](#create-list-partition-table)
    +* [Show Partitions](#show-partitions)
    +* [Maintain the Partitions](#maintain-the-partitions)
    +* [Partition Id](#partition-id)
    +* [Tips](#tips)
    +
    +### Create Partition Table
    +
    +##### Create Hash Partition Table
    +```
    +   CREATE TABLE [IF NOT EXISTS] [db_name.]table_name
    +                    [(col_name data_type , ...)]
    +   STORED BY 'carbondata'
    +   PARTITIONED BY (partition_col_name data_type)
    --- End diff --
   
    I can see there are two functions validateTypeConvert and validateTypeConvertForSpark2 in CommonUtil.scala to validate partition column type. It's added by some other contributor.


---
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 [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1258: [CARBONDATA-1325] Add partition guidance doc

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user lionelcao commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1258#discussion_r135381322
 
    --- Diff: docs/partition-guide.md ---
    @@ -0,0 +1,124 @@
    +<!--
    +    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.
    +-->
    +
    +### CarbonData Partition Table Guidance
    +This guidance illustrates how to create & use partition table in CarbonData.
    +
    +* [Create Partition Table](#create-partition-table)
    +  - [Create Hash Partition Table](#create-hash-partition-table)
    +  - [Create Range Partition Table](#create-range-partition-table)
    +  - [Create List Partition Table](#create-list-partition-table)
    +* [Show Partitions](#show-partitions)
    +* [Maintain the Partitions](#maintain-the-partitions)
    +* [Partition Id](#partition-id)
    +* [Tips](#tips)
    +
    +### Create Partition Table
    +
    +##### Create Hash Partition Table
    +```
    +   CREATE TABLE [IF NOT EXISTS] [db_name.]table_name
    +                    [(col_name data_type , ...)]
    +   STORED BY 'carbondata'
    +   PARTITIONED BY (partition_col_name data_type)
    +   [TBLPROPERTIES ('PARTITION_TYPE'='HASH',
    +                   'PARTITION_NUM'='N' ...)]  
    +   //N is the number of hash partitions
    +```
    +
    +##### Create Range Partition Table
    +```
    +   CREATE TABLE [IF NOT EXISTS] [db_name.]table_name
    +                    [(col_name data_type , ...)]
    +   STORED BY 'carbondata'
    +   PARTITIONED BY (partition_col_name data_type)
    +   [TBLPROPERTIES ('PARTITION_TYPE'='RANGE',
    +                   'RANGE_INFO'='2014-01-01, 2015-01-01, 2016-01-01' ...)]
    +```
    +Notes:
    +1. The 'RANGE_INFO' defined in table properties must be in ascending order.
    +2. If the partition column is Date/Timestamp type, the format could be defined in CarbonProperties. By default it's yyyy-MM-dd.
    +
    +##### Create List Partition Table
    +```
    +   CREATE TABLE [IF NOT EXISTS] [db_name.]table_name
    +                    [(col_name data_type , ...)]
    +   STORED BY 'carbondata'
    +   PARTITIONED BY (partition_col_name data_type)
    +   [TBLPROPERTIES ('PARTITION_TYPE'='LIST',
    +                   'LIST_INFO'='A, B, C' ...)]
    +```
    +Notes:
    +1. List partition support list info in one level group. For example,
    +```
    +   ...
    +   'LIST_INFO' = 'A, B, (C, D), (E, F, G), H'
    +   ...
    +```
    +
    +
    +### Show Partitions
    +Execute following command to get the partition information
    +```
    +   SHOW PARTITIONS [db_name.]table_name
    +
    +```
    +
    +### Maintain the Partitions
    +##### Add a new partition
    +```
    +   ALTER TABLE [db_name].table_name ADD PARTITION('new_partition')
    +```
    +##### Split a partition
    +```
    +   ALTER TABLE [db_name].table_name SPLIT PARTITION(partition_id) INTO('new_partition1', 'new_partition2'...)
    +```
    +##### Drop a partition
    +```
    +   //Drop partition definition only and keep data
    +   ALTER TABLE [db_name].table_name DROP PARTITION(partition_id)
    +  
    +   //Drop both partition definition and data
    +   ALTER TABLE [db_name].table_name DROP PARTITION(partition_id) WITH DATA
    +```
    +Notes:
    +1. For the 1st case(keep data),
    +   * if the table is a range partition table, data will be merged into the later partition, and if the dropped partition is the last one, then data will be merged into default partition.
    +   * if the table is a list partition table, data will be merged into default partition.
    +2. Drop default partition is not allowed, but you can use DELETE statement to delete data in default partition.
    --- End diff --
   
    Please refer to dml documents about delete from statement.


---
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 [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #1258: [CARBONDATA-1325] Add partition guidance doc

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user chenliang613 commented on the issue:

    https://github.com/apache/carbondata/pull/1258
 
    @lionelcao  please add one link in README.md for partition-guide.md


---
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 [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #1258: [CARBONDATA-1325] Add partition guidance doc

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user chenliang613 commented on the issue:

    https://github.com/apache/carbondata/pull/1258
 
    LGTM


---
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 [hidden email] or file a JIRA ticket
with INFRA.
---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #1258: [CARBONDATA-1325] Add partition guidance doc

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user asfgit closed the pull request at:

    https://github.com/apache/carbondata/pull/1258


---
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 [hidden email] or file a JIRA ticket
with INFRA.
---