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

Alvin Henrick edited comment on TAJO-744 at 4/29/14 5:44 PM:
-------------------------------------------------------------

Hyunsik , Thank you .That was very helpful. I am using the existing add 
Partition Method in AbstractDBStore.I have modified the Schema a little bit. 

I have also created the review request  https://reviews.apache.org/r/20852/.

NOTE :-- The work is still in progress but wanted the feedback.

I wanted to implement Drop partition but thought this is the right time to 
discuss.I am planning to introduce partition method id (PM_ID) in 
PARTITION_METHODS table.

I am also planning to introduce  PARTITION_METHODS_STORE table which will store 
information related to partition.This is how it will look like.


|| 
ID||PM_ID||TID||COL_NAME||COL_INT||COL_FLOAT||COL_TEXT||COL_DATE||COL_BOOL||COMPOSITE||
| 1|1|1|COUNTRY| | |"US"| | |2|
| 2|1|1|JOIN_DATE| | | |"2008-08-08"| |2|
| 3|2|1|FNAME| | |"Alvin"| | |1|
| 4|3|1|LNAME| | |"Joe"| | |2|
| 5|3|1|DOB| | | |"1980-08-10"| |2|
| 6|4|1|RETIRED| | | | |TRUE|2|
| 7|4|1|JOIN_DATE| | | |"1940-07-14"| |2|
| 8|5|1|COUNTRY| | |"US"| | |3|
| 9|5|1|JOIN_DATE| | | |"2008-08-08"| |3|
| 6|5|1|RETIRED| | | | |TRUE|3|

This will help us to query the PM_ID to drop the partition from 
PARTITION_METHODS table.

{panel} 
SELECT PM_ID from PARTITION_METHODS_STORE where ((COL_NAME='JOIN_DATE' AND 
COL_DATE = '2008-08-08') OR
(COL_NAME='COUNTRY' AND COL_TEXT='US')) AND TID = 1 AND COMPOSITE = 2 GROUP BY 
PM_ID
{panel}

{panel} 
SELECT PM_ID from PARTITION_METHODS_STORE where (COL_NAME='FNAME' AND COL_TEXT 
= 'Alvin') AND TID = 1 AND COMPOSITE = 1  
{panel}

COMPOSITE stands for number of columns involved in partition.

Thanks!
Warm Regards,
Alvin.


was (Author: alvinhenrick):
Hyunsik , Thank you .That was very helpful. I am using the existing add 
Partition Method in AbstractDBStore.I have modified the Schema a little bit. 

I have also created the review request  https://reviews.apache.org/r/20852/.

NOTE :-- The work is still in progress but wanted the feedback.

I wanted to implement Drop partition but thought this is the right time to 
discuss.I am planning to introduce partition method id (PM_ID) in 
PARTITION_METHODS table.

I am also planning to introduce  PARTITION_METHODS_STORE table which will store 
information related to partition.This is how it will look like.


|| 
ID||PM_ID||TID||COL_NAME||COL_INT||COL_FLOAT||COL_TEXT||COL_DATE||COL_BOOL||COMPOSITE||
| 1|1|1|COUNTRY| | |"US"| | |2|
| 2|1|1|JOIN_DATE| | | |"2008-08-08"| |2|
| 3|2|1|FNAME| | |"Alvin"| | |1|
| 4|3|1|LNAME| | |"Joe"| | |2|
| 5|3|1|DOB| | | |"1980-08-10"| |2|
| 6|4|1|RETIRED| | | | |TRUE|2|
| 7|4|1|JOIN_DATE| | | |"1940-07-14"| |2|

This will help us to query the PM_ID to drop the partition from 
PARTITION_METHODS table.

{panel} 
SELECT PM_ID from PARTITION_METHODS_STORE where ((COL_NAME='JOIN_DATE' AND 
COL_DATE = '2008-08-08') OR
(COL_NAME='COUNTRY' AND COL_TEXT='US')) AND TID = 1 AND COMPOSITE = 2 GROUP BY 
PM_ID
{panel}

{panel} 
SELECT PM_ID from PARTITION_METHODS_STORE where (COL_NAME='FNAME' AND COL_TEXT 
= 'Alvin') AND TID = 1 AND COMPOSITE = 1  
{panel}

COMPOSITE stands for number of columns involved in partition.

Thanks!
Warm Regards,
Alvin.

> ALTER TABLE ADD/DROP PARTITION statement
> ----------------------------------------
>
>                 Key: TAJO-744
>                 URL: https://issues.apache.org/jira/browse/TAJO-744
>             Project: Tajo
>          Issue Type: New Feature
>          Components: catalog
>    Affects Versions: 0.9.0
>            Reporter: Hyunsik Choi
>            Assignee: Alvin Henrick
>             Fix For: 0.9.0
>
>         Attachments: TAJO-744.Henrick-140423.01.patch.txt
>
>
> Currently, Tajo does not manage partitioned directly. In Tajo, each partition 
> is just a directory. For each query, a logical planner traverses matched 
> directories in HDFS according to partition predicates.
> This approach is not efficient especially in the environment where the number 
> of partitions are very large. It also makes partition management hard.
> Tajo should manage partitions directly by using ALTER TABLE ADD/DROP 
> PARTITION statements. A number of partition entries should be stored in the 
> underlying database that catalog uses.
> {code:title=Synopsis of ALTER TABLE ADD/DROP PARTITION}
> ALTER TABLE table_name [IF NOT EXISTS] ADD COLUMN PARTITION (key1 = 'val2', 
> key2 = 'val2', ...) WITH ('prop_key' = 'prop_val', ...) LOCATION '...';
> ALTER TABLE table_name [IF EXISTS] DROP COLUMN PARTITION  (key1 
> [=|<|<=|>|>=|!=] 'val1');
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to