I think the syntax of segment compaction should be similar with that of other 
management on segment.
Currently in carbondata, we delete segment using syntax:
```
DELETE FROM TABLE CarbonDatabase.CarbonTable WHERE SEGMENT.ID IN (0,5,8)
```
And
```
DELETE FROM TABLE CarbonDatabase.CarbonTable WHERE SEGMENT.STARTTIME BEFORE 
'2017-06-01 12:05:06' 
```

So, we can imitate the above syntax and get the followings:
```
ALTER TABLE [db_name.]table_name COMPACT 'MINOR/MAJOR' WHERE SEGMENT.ID IN 
(0,5,8)
```
And
```
ALTER TABLE [db_name.]table_name COMPACT 'MINOR/MAJOR' WHERE SEGMENT.STARTTIME 
BEFORE '2017-06-01 12:05:06' AND SEGMENT.STARTTIME AFTER '2017-05-01 12:05:06' 
```
We can support compact segment by specifying IDs and dates.


-----原始邮件-----
发件人:xuchuanyin <xuchuan...@hust.edu.cn>
发送时间:2018-03-12 20:23:20 (星期一)
收件人: "Jin Zhou" <dev@carbondata.apache.org>
抄送: carbondata <dev@carbondata.apache.org>
主题: Re: [Discussion] About syntax of compaction on specified segments


what does 1/2/3/4 mean in your example? If it is the segment id, probably 
compact segments by specifying date range is also needed.


FROM MOBILE EMAIL CLIENT


在2018年03月12日 10:31,Jin Zhou 写道:
Hi, community:

I'm working on PR-1812
( https://github.com/apache/carbondata/pull/1812
<https://github.com/apache/carbondata/pull/1812&gt;  )
which aims to support user specified segments in compaction operation.

After previous discussions, I think there are 3 possible ways to implement
the function:
1) Extending existing SQL syntax of Major and Minor compaciton:
   ALTER TABLE tablename compact 'MAJOR' '1, 2, 3, 4';
   ALTER TABLE tablename compact 'MINOR' '1, 2, 3, 4';

2) Adding support for CARBON_INPUT_SEGMENTS property of Major and Minor
compaciton:
   SET carbon.input.segments.dbname.tablename=1,3;
   ALTER TABLE tablename compact 'MAJOR';

3) Adding a new compaction type and some associated configs, for example,
'CUSTOM' :
   ALTER TABLE tablename compact 'CUSTOM' '1, 2, 3, 4'

I'm grateful for advice from chenliang,ravipesala and gvramana ,detailed
discussion history can be seen on web page:
( https://github.com/apache/carbondata/pull/1812
<https://github.com/apache/carbondata/pull/1812&gt;  )

Now I'm a bit confused and really need your suggestion :)






--
Sent from: 
http://apache-carbondata-dev-mailing-list-archive.1130556.n5.nabble.com/

Reply via email to