After the DELETE SEGMENT command is executed, the deleted segments are marked as the delete state. After the segments are merged, the status of the original segments changes to compacted. The data files of these segments are not physically deleted. If you want to forcibly delete these files, run the CLEAN FILES command.
However, running this command may result in a query command execution failure.
CLEAN FILES FOR TABLE [db_name.]table_name ;
Parameter |
Description |
---|---|
db_name |
Database name. It consists of letters, digits, and underscores (_). |
table_name |
Name of the database table. It consists of letters, digits, and underscores (_). |
None
Add Carbon configuration parameters.
carbon.clean.file.force.allowed = true
create table carbon01(a int,b string,c string) stored as carbondata;
insert into table carbon01 select 1,'a','aa';
insert into table carbon01 select 2,'b','bb';
delete from table carbon01 where segment.id in (0);
show segments for table carbon01;
CLEAN FILES FOR TABLE carbon01 options('force'='true');
show segments for table carbon01;
In this example, all the segments marked as deleted and compacted are physically deleted.
Success or failure will be recorded in the driver logs.