Skip to content

Commit

Permalink
[fix](delete) storage engine delete do not support bitmap (apache#34710)
Browse files Browse the repository at this point in the history
  • Loading branch information
morrySnow authored and M1saka2003 committed May 14, 2024
1 parent eba336d commit 59c12d3
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ private void checkDeleteConditions() throws AnalysisException {
// TODO(Now we can not push down non-scala type like array/map/struct to storage layer because of
// predict_column in be not support non-scala type, so we just should ban this type in delete predict, when
// we delete predict_column in be we should delete this ban)
if (!column.getType().isScalarType()) {
if (!column.getType().isScalarType()
|| (column.getType().isOnlyMetricType() && !column.getType().isJsonbType())) {
throw new AnalysisException(String.format("Can not apply delete condition to column type: %s ",
column.getType()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ private void checkColumn(Set<String> tableColumns, SlotReference slotReference,
// TODO(Now we can not push down non-scala type like array/map/struct to storage layer because of
// predict_column in be not support non-scala type, so we just should ban this type in delete predict, when
// we delete predict_column in be we should delete this ban)
if (!column.getType().isScalarType()) {
if (!column.getType().isScalarType()
|| (column.getType().isOnlyMetricType() && !column.getType().isJsonbType())) {
throw new AnalysisException(String.format("Can not apply delete condition to column type: "
+ column.getType()));
}
Expand Down
29 changes: 29 additions & 0 deletions regression-test/suites/delete_p0/test_delete.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -483,4 +483,33 @@ suite("test_delete") {
sql "set experimental_enable_nereids_planner = false;"
sql "set @data_batch_num='2024-01-31 00:00:00';"
sql "delete from bi_acti_per_period_plan where data_batch_num =@data_batch_num; "

// delete bitmap
sql "drop table if exists table_bitmap"
sql """
CREATE TABLE if not exists `table_bitmap` (
`dt` DATE NULL,
`page_id` INT NULL,
`page_level` INT NULL,
`user_id` BITMAP NOT NULL
) ENGINE=OLAP
DUPLICATE KEY(`dt`, `page_id`, `page_level`)
COMMENT 'OLAP'
DISTRIBUTED BY HASH(`dt`) BUCKETS 10
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);
"""

sql """
insert into table_bitmap values
('2021-12-09', 101 , 1 , BITMAP_FROM_STRING('100001,100002,100003,100004,100005')),
('2021-12-09', 102 , 2 , BITMAP_FROM_STRING('100001,100003,100004')),
('2021-12-09', 103 , 3 , BITMAP_FROM_STRING('100003'));
"""

test {
sql "delete from table_bitmap where user_id is null"
exception "Can not apply delete condition to column type: BITMAP"
}
}

0 comments on commit 59c12d3

Please sign in to comment.