@@ -61,6 +61,7 @@ pub struct RuntimeFilterEntry {
6161 pub id : usize ,
6262 pub probe_expr : Expr < String > ,
6363 pub bloom : Option < RuntimeFilterBloom > ,
64+ pub spatial : Option < RuntimeFilterSpatial > ,
6465 pub inlist : Option < Expr < String > > ,
6566 pub inlist_value_count : usize ,
6667 pub min_max : Option < Expr < String > > ,
@@ -76,13 +77,24 @@ pub struct RuntimeFilterBloom {
7677 pub filter : RuntimeBloomFilter ,
7778}
7879
80+ #[ derive( Clone ) ]
81+ pub struct RuntimeFilterSpatial {
82+ pub column_name : String ,
83+ pub srid : i32 ,
84+ pub rtrees : Arc < Vec < u8 > > ,
85+ pub rtree_bounds : Option < [ f64 ; 4 ] > ,
86+ }
87+
7988#[ derive( Default ) ]
8089pub struct RuntimeFilterStats {
8190 bloom_time_ns : AtomicU64 ,
8291 bloom_rows_filtered : AtomicU64 ,
8392 inlist_min_max_time_ns : AtomicU64 ,
8493 min_max_rows_filtered : AtomicU64 ,
8594 min_max_partitions_pruned : AtomicU64 ,
95+ spatial_time_ns : AtomicU64 ,
96+ spatial_rows_filtered : AtomicU64 ,
97+ spatial_partitions_pruned : AtomicU64 ,
8698}
8799
88100impl RuntimeFilterStats {
@@ -105,13 +117,24 @@ impl RuntimeFilterStats {
105117 . fetch_add ( partitions_pruned, Ordering :: Relaxed ) ;
106118 }
107119
120+ pub fn record_spatial ( & self , time_ns : u64 , rows_filtered : u64 , partitions_pruned : u64 ) {
121+ self . spatial_time_ns . fetch_add ( time_ns, Ordering :: Relaxed ) ;
122+ self . spatial_rows_filtered
123+ . fetch_add ( rows_filtered, Ordering :: Relaxed ) ;
124+ self . spatial_partitions_pruned
125+ . fetch_add ( partitions_pruned, Ordering :: Relaxed ) ;
126+ }
127+
108128 pub fn snapshot ( & self ) -> RuntimeFilterStatsSnapshot {
109129 RuntimeFilterStatsSnapshot {
110130 bloom_time_ns : self . bloom_time_ns . load ( Ordering :: Relaxed ) ,
111131 bloom_rows_filtered : self . bloom_rows_filtered . load ( Ordering :: Relaxed ) ,
112132 inlist_min_max_time_ns : self . inlist_min_max_time_ns . load ( Ordering :: Relaxed ) ,
113133 min_max_rows_filtered : self . min_max_rows_filtered . load ( Ordering :: Relaxed ) ,
114134 min_max_partitions_pruned : self . min_max_partitions_pruned . load ( Ordering :: Relaxed ) ,
135+ spatial_time_ns : self . spatial_time_ns . load ( Ordering :: Relaxed ) ,
136+ spatial_rows_filtered : self . spatial_rows_filtered . load ( Ordering :: Relaxed ) ,
137+ spatial_partitions_pruned : self . spatial_partitions_pruned . load ( Ordering :: Relaxed ) ,
115138 }
116139 }
117140}
@@ -123,6 +146,9 @@ pub struct RuntimeFilterStatsSnapshot {
123146 pub inlist_min_max_time_ns : u64 ,
124147 pub min_max_rows_filtered : u64 ,
125148 pub min_max_partitions_pruned : u64 ,
149+ pub spatial_time_ns : u64 ,
150+ pub spatial_rows_filtered : u64 ,
151+ pub spatial_partitions_pruned : u64 ,
126152}
127153
128154#[ derive( Clone , Debug ) ]
0 commit comments