@@ -689,6 +689,18 @@ suite("test_analyze_mv") {
689
689
assertEquals (" 0" , result_row[0 ][3 ])
690
690
assertEquals (" -1" , result_row[0 ][4 ])
691
691
692
+ // ** Embedded test for skip auto analyze when table is empty
693
+ sql """ analyze table mvTestDup properties ("use.auto.analyzer" = "true")"""
694
+ def empty_test = sql """ show auto analyze mvTestDup"""
695
+ assertEquals (0 , empty_test. size())
696
+ empty_test = sql """ show column stats mvTestDup"""
697
+ assertEquals (0 , empty_test. size())
698
+ // ** End of embedded test
699
+
700
+ sql """ analyze table mvTestDup with sync"""
701
+ empty_test = sql """ show column stats mvTestDup"""
702
+ assertEquals (12 , empty_test. size())
703
+
692
704
for (int i = 0 ; i < 120 ; i++ ) {
693
705
result_row = sql """ show index stats mvTestDup mv3"""
694
706
logger. info(" mv3 stats: " + result_row)
@@ -703,6 +715,27 @@ suite("test_analyze_mv") {
703
715
assertEquals (" mv3" , result_row[0 ][1 ])
704
716
assertEquals (" 0" , result_row[0 ][3 ])
705
717
assertEquals (" 0" , result_row[0 ][4 ])
718
+
719
+ // ** Embedded test for skip auto analyze when table is empty again
720
+ sql """ analyze table mvTestDup properties ("use.auto.analyzer" = "true")"""
721
+ empty_test = sql """ show auto analyze mvTestDup"""
722
+ assertEquals (0 , empty_test. size())
723
+ empty_test = sql """ show column stats mvTestDup"""
724
+ for (int i = 0 ; i < 100 ; i++ ) {
725
+ empty_test = sql """ show column stats mvTestDup"""
726
+ if (empty_test. size() != 0 ) {
727
+ logger. info(" async delete is not finished yet." )
728
+ Thread . sleep(1000 )
729
+ }
730
+ break
731
+ }
732
+ assertEquals (0 , empty_test. size())
733
+ // ** End of embedded test
734
+
735
+ sql """ analyze table mvTestDup with sync"""
736
+ empty_test = sql """ show column stats mvTestDup"""
737
+ assertEquals (12 , empty_test. size())
738
+
706
739
sql """ insert into mvTestDup values (1, 2, 3, 4, 5), (1, 2, 3, 4, 5), (10, 20, 30, 40, 50), (10, 20, 30, 40, 50), (100, 200, 300, 400, 500), (1001, 2001, 3001, 4001, 5001);"""
707
740
result_row = sql """ show index stats mvTestDup mv3"""
708
741
assertEquals (1 , result_row. size())
0 commit comments