airborne12 commented on code in PR #23818:
URL: https://github.com/apache/doris/pull/23818#discussion_r1314471377


##########
regression-test/suites/index_p0/test_bitmap_index.groovy:
##########
@@ -269,4 +269,102 @@ suite("test_bitmap_index") {
         }
     }
     sql "DROP TABLE ${tbName3} FORCE;"
+
+    // test bitmap index on MOR, and delete row after insert
+    def tbName4 = "test_bitmap_index_unique_mor_delete"
+        sql "DROP TABLE IF EXISTS ${tbName4}"
+        sql """
+                CREATE TABLE ${tbName4} (
+                    create_time datetime NOT NULL COMMENT '',
+                    vid varchar(64) NOT NULL COMMENT '',
+                    report_time datetime NULL COMMENT '',
+                    block_version int(11) NULL COMMENT '',
+                    vehicle_mode int(11) NULL COMMENT '',
+                    usage_mode int(11) NULL COMMENT ''
+                ) ENGINE=OLAP
+                UNIQUE KEY(create_time, vid, report_time)
+                COMMENT 'OLAP'
+                PARTITION BY RANGE(create_time)
+                (PARTITION p20230820 VALUES [('2023-08-20 00:00:00'), 
('2023-08-21 00:00:00')),
+                PARTITION p20230821 VALUES [('2023-08-21 00:00:00'), 
('2023-08-22 00:00:00')),
+                PARTITION p20230822 VALUES [('2023-08-22 00:00:00'), 
('2023-08-23 00:00:00')),
+                PARTITION p20230823 VALUES [('2023-08-23 00:00:00'), 
('2023-08-24 00:00:00')),
+                PARTITION p20230824 VALUES [('2023-08-24 00:00:00'), 
('2023-08-25 00:00:00')),
+                PARTITION p20230825 VALUES [('2023-08-25 00:00:00'), 
('2023-08-26 00:00:00')),
+                PARTITION p20230826 VALUES [('2023-08-26 00:00:00'), 
('2023-08-27 00:00:00')),
+                PARTITION p20230827 VALUES [('2023-08-27 00:00:00'), 
('2023-08-28 00:00:00')),
+                PARTITION p20230828 VALUES [('2023-08-28 00:00:00'), 
('2023-08-29 00:00:00')),
+                PARTITION p20230829 VALUES [('2023-08-29 00:00:00'), 
('2023-08-30 00:00:00')))
+                DISTRIBUTED BY HASH(vid) BUCKETS AUTO
+                PROPERTIES (
+                "replication_allocation" = "tag.location.default: 1",
+                "is_being_synced" = "false",
+                "dynamic_partition.enable" = "true",
+                "dynamic_partition.time_unit" = "DAY",
+                "dynamic_partition.time_zone" = "Asia/Shanghai",
+                "dynamic_partition.start" = "-30",
+                "dynamic_partition.end" = "1",
+                "dynamic_partition.prefix" = "p",
+                "dynamic_partition.replication_allocation" = 
"tag.location.default: 1",
+                "dynamic_partition.buckets" = "10",
+                "dynamic_partition.create_history_partition" = "true",
+                "dynamic_partition.history_partition_num" = "-1",
+                "dynamic_partition.hot_partition_num" = "0",
+                "dynamic_partition.reserved_history_periods" = "NULL",
+                "dynamic_partition.storage_policy" = "",
+                "storage_format" = "V2",
+                "light_schema_change" = "true",
+                "disable_auto_compaction" = "false",
+                "enable_single_replica_compaction" = "false"
+                );
+            """
+
+        sql """
+                ALTER TABLE ${tbName4} ADD INDEX vid_bitmap_index (vid) USING 
BITMAP;
+            """
+        max_try_secs = 60
+        while (max_try_secs--) {
+            String res = getJobState(tbName3)
+            if (res == "FINISHED" || res == "CANCELLED") {
+                assertEquals("FINISHED", res)
+                sleep(3000)
+                break
+            } else {
+                Thread.sleep(1000)
+                if (max_try_secs < 1) {
+                    println "test timeout," + "state:" + res
+                    assertEquals("FINISHED",res)
+                }
+            }
+        }
+
+        sql "insert into 
${tbName4}(create_time,vid,report_time,block_version,vehicle_mode,usage_mode) 
values('2023-08-25 10:00:00','123','2023-08-25 10:00:00',1,1,1);"
+        sql "insert into 
${tbName4}(create_time,vid,report_time,block_version,vehicle_mode,usage_mode) 
values('2023-08-25 11:00:00','123','2023-08-25 11:00:00',2,2,2);"
+        sql "insert into 
${tbName4}(create_time,vid,report_time,block_version,vehicle_mode,usage_mode) 
values('2023-08-25 12:00:00','123','2023-08-25 12:00:00',3,3,3);"
+        qt_sql "desc ${tbName4};"
+        qt_sql "SHOW INDEX FROM ${tbName4};"
+        sql "delete from ${tbName4} where vid='123' and 
report_time='2023-08-25 12:00:00' and create_time='2023-08-25 12:00:00';"
+        qt_sql "select count() from ${tbName4}; "
+        qt_sql "select count() from ${tbName4} where vid='123'; "
+        qt_sql "select count(*) from ${tbName4} where create_time>='2023-08-25 
10:00:00';"
+        qt_sql "select count(CASE when vid='123' then 1 else null end) from 
${tbName4} where vid='123';"
+        qt_sql "select * from ${tbName4} where vid='123';"

Review Comment:
   need to order by 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to