@@ -230,7 +230,7 @@ pub trait IndexerBuilder {
230230}
231231#[ derive( Clone ) ]
232232pub ( crate ) struct IndexerBuilderImpl {
233- pub ( crate ) op_type : OperationType ,
233+ pub ( crate ) build_type : IndexBuildType ,
234234 pub ( crate ) metadata : RegionMetadataRef ,
235235 pub ( crate ) row_group_size : usize ,
236236 pub ( crate ) puffin_manager : SstPuffinManager ,
@@ -270,9 +270,10 @@ impl IndexerBuilder for IndexerBuilderImpl {
270270
271271impl IndexerBuilderImpl {
272272 fn build_inverted_indexer ( & self , file_id : FileId ) -> Option < InvertedIndexer > {
273- let create = match self . op_type {
274- OperationType :: Flush => self . inverted_index_config . create_on_flush . auto ( ) ,
275- OperationType :: Compact => self . inverted_index_config . create_on_compaction . auto ( ) ,
273+ let create = match self . build_type {
274+ IndexBuildType :: Flush => self . inverted_index_config . create_on_flush . auto ( ) ,
275+ IndexBuildType :: Compact => self . inverted_index_config . create_on_compaction . auto ( ) ,
276+ _ => true ,
276277 } ;
277278
278279 if !create {
@@ -330,9 +331,10 @@ impl IndexerBuilderImpl {
330331 }
331332
332333 async fn build_fulltext_indexer ( & self , file_id : FileId ) -> Option < FulltextIndexer > {
333- let create = match self . op_type {
334- OperationType :: Flush => self . fulltext_index_config . create_on_flush . auto ( ) ,
335- OperationType :: Compact => self . fulltext_index_config . create_on_compaction . auto ( ) ,
334+ let create = match self . build_type {
335+ IndexBuildType :: Flush => self . fulltext_index_config . create_on_flush . auto ( ) ,
336+ IndexBuildType :: Compact => self . fulltext_index_config . create_on_compaction . auto ( ) ,
337+ _ => true ,
336338 } ;
337339
338340 if !create {
@@ -383,9 +385,10 @@ impl IndexerBuilderImpl {
383385 }
384386
385387 fn build_bloom_filter_indexer ( & self , file_id : FileId ) -> Option < BloomFilterIndexer > {
386- let create = match self . op_type {
387- OperationType :: Flush => self . bloom_filter_index_config . create_on_flush . auto ( ) ,
388- OperationType :: Compact => self . bloom_filter_index_config . create_on_compaction . auto ( ) ,
388+ let create = match self . build_type {
389+ IndexBuildType :: Flush => self . bloom_filter_index_config . create_on_flush . auto ( ) ,
390+ IndexBuildType :: Compact => self . bloom_filter_index_config . create_on_compaction . auto ( ) ,
391+ _ => true ,
389392 } ;
390393
391394 if !create {
@@ -446,6 +449,15 @@ pub enum IndexBuildType {
446449 Manual ,
447450}
448451
452+ impl From < OperationType > for IndexBuildType {
453+ fn from ( op_type : OperationType ) -> Self {
454+ match op_type {
455+ OperationType :: Flush => IndexBuildType :: Flush ,
456+ OperationType :: Compact => IndexBuildType :: Compact ,
457+ }
458+ }
459+ }
460+
449461#[ derive( Debug , PartialEq , Clone ) ]
450462pub enum IndexBuildOutcome {
451463 Finished ,
@@ -672,6 +684,7 @@ mod tests {
672684 use object_store:: ObjectStore ;
673685 use object_store:: services:: Memory ;
674686 use puffin_manager:: PuffinManagerFactory ;
687+ use serde_json:: value:: Index ;
675688 use store_api:: metadata:: { ColumnMetadata , RegionMetadataBuilder } ;
676689 use tokio:: sync:: { mpsc, oneshot} ;
677690
@@ -830,7 +843,7 @@ mod tests {
830843 ) ,
831844 ) ;
832845 Arc :: new ( IndexerBuilderImpl {
833- op_type : OperationType :: Flush ,
846+ build_type : IndexBuildType :: Flush ,
834847 metadata,
835848 row_group_size : 1024 ,
836849 puffin_manager,
@@ -854,7 +867,7 @@ mod tests {
854867 with_skipping_bloom : true ,
855868 } ) ;
856869 let indexer = IndexerBuilderImpl {
857- op_type : OperationType :: Flush ,
870+ build_type : IndexBuildType :: Flush ,
858871 metadata,
859872 row_group_size : 1024 ,
860873 puffin_manager : factory. build ( mock_object_store ( ) , NoopPathProvider ) ,
@@ -884,7 +897,7 @@ mod tests {
884897 with_skipping_bloom : true ,
885898 } ) ;
886899 let indexer = IndexerBuilderImpl {
887- op_type : OperationType :: Flush ,
900+ build_type : IndexBuildType :: Flush ,
888901 metadata : metadata. clone ( ) ,
889902 row_group_size : 1024 ,
890903 puffin_manager : factory. build ( mock_object_store ( ) , NoopPathProvider ) ,
@@ -905,7 +918,7 @@ mod tests {
905918 assert ! ( indexer. bloom_filter_indexer. is_some( ) ) ;
906919
907920 let indexer = IndexerBuilderImpl {
908- op_type : OperationType :: Compact ,
921+ build_type : IndexBuildType :: Compact ,
909922 metadata : metadata. clone ( ) ,
910923 row_group_size : 1024 ,
911924 puffin_manager : factory. build ( mock_object_store ( ) , NoopPathProvider ) ,
@@ -926,7 +939,7 @@ mod tests {
926939 assert ! ( indexer. bloom_filter_indexer. is_some( ) ) ;
927940
928941 let indexer = IndexerBuilderImpl {
929- op_type : OperationType :: Compact ,
942+ build_type : IndexBuildType :: Compact ,
930943 metadata,
931944 row_group_size : 1024 ,
932945 puffin_manager : factory. build ( mock_object_store ( ) , NoopPathProvider ) ,
@@ -959,7 +972,7 @@ mod tests {
959972 with_skipping_bloom : true ,
960973 } ) ;
961974 let indexer = IndexerBuilderImpl {
962- op_type : OperationType :: Flush ,
975+ build_type : IndexBuildType :: Flush ,
963976 metadata : metadata. clone ( ) ,
964977 row_group_size : 1024 ,
965978 puffin_manager : factory. build ( mock_object_store ( ) , NoopPathProvider ) ,
@@ -982,7 +995,7 @@ mod tests {
982995 with_skipping_bloom : true ,
983996 } ) ;
984997 let indexer = IndexerBuilderImpl {
985- op_type : OperationType :: Flush ,
998+ build_type : IndexBuildType :: Flush ,
986999 metadata : metadata. clone ( ) ,
9871000 row_group_size : 1024 ,
9881001 puffin_manager : factory. build ( mock_object_store ( ) , NoopPathProvider ) ,
@@ -1005,7 +1018,7 @@ mod tests {
10051018 with_skipping_bloom : false ,
10061019 } ) ;
10071020 let indexer = IndexerBuilderImpl {
1008- op_type : OperationType :: Flush ,
1021+ build_type : IndexBuildType :: Flush ,
10091022 metadata : metadata. clone ( ) ,
10101023 row_group_size : 1024 ,
10111024 puffin_manager : factory. build ( mock_object_store ( ) , NoopPathProvider ) ,
@@ -1035,7 +1048,7 @@ mod tests {
10351048 with_skipping_bloom : true ,
10361049 } ) ;
10371050 let indexer = IndexerBuilderImpl {
1038- op_type : OperationType :: Flush ,
1051+ build_type : IndexBuildType :: Flush ,
10391052 metadata,
10401053 row_group_size : 0 ,
10411054 puffin_manager : factory. build ( mock_object_store ( ) , NoopPathProvider ) ,
@@ -1317,7 +1330,7 @@ mod tests {
13171330 ) ;
13181331 // Indexer builder built from write cache.
13191332 let indexer_builder = Arc :: new ( IndexerBuilderImpl {
1320- op_type : OperationType :: Flush ,
1333+ build_type : IndexBuildType :: Flush ,
13211334 metadata : metadata. clone ( ) ,
13221335 row_group_size : 1024 ,
13231336 puffin_manager : write_cache. build_puffin_manager ( ) . clone ( ) ,
0 commit comments