@@ -22,6 +22,7 @@ use crate::config::ObsStorageConfig;
2222use crate :: config:: OssStorageConfig ;
2323use crate :: config:: QueryConfig ;
2424use crate :: config:: S3StorageConfig ;
25+ use crate :: config:: SpillConfig ;
2526use crate :: config:: WebhdfsStorageConfig ;
2627use crate :: Config ;
2728use crate :: StorageConfig ;
@@ -51,7 +52,7 @@ impl Config {
5152 storage : self . storage . mask_display ( ) ,
5253 catalog : self . catalog ,
5354 cache : self . cache ,
54- spill : self . spill ,
55+ spill : self . spill . mask_display ( ) ,
5556 background : self . background ,
5657 catalogs : self . catalogs ,
5758 }
@@ -212,6 +213,24 @@ impl StorageConfig {
212213 }
213214}
214215
216+ impl SpillConfig {
217+ fn mask_display ( & self ) -> Self {
218+ let Self {
219+ ref spill_local_disk_path,
220+ spill_local_disk_reserved_space_percentage,
221+ spill_local_disk_max_bytes,
222+ ref storage,
223+ } = * self ;
224+
225+ Self {
226+ spill_local_disk_path : spill_local_disk_path. clone ( ) ,
227+ spill_local_disk_reserved_space_percentage,
228+ spill_local_disk_max_bytes,
229+ storage : storage. as_ref ( ) . map ( |storage| storage. mask_display ( ) ) ,
230+ }
231+ }
232+ }
233+
215234#[ cfg( test) ]
216235mod tests {
217236 use super :: * ;
@@ -354,4 +373,32 @@ mod tests {
354373 assert_eq ! ( masked_config. cos_secret_id, "**********_id" ) ;
355374 assert_eq ! ( masked_config. cos_secret_key, "***********key" ) ;
356375 }
376+
377+ #[ test]
378+ fn test_spill_config ( ) {
379+ let config = SpillConfig {
380+ spill_local_disk_path : "" . to_string ( ) ,
381+ spill_local_disk_reserved_space_percentage : 30.0 . into ( ) ,
382+ spill_local_disk_max_bytes : 10 ,
383+ storage : Some ( StorageConfig {
384+ typ : "s3" . to_string ( ) ,
385+ s3 : S3StorageConfig {
386+ secret_access_key : "secret_access_key" . to_string ( ) ,
387+ security_token : "security_token" . to_string ( ) ,
388+ ..S3StorageConfig :: default ( )
389+ } ,
390+ ..StorageConfig :: default ( )
391+ } ) ,
392+ } ;
393+
394+ let masked_config = config. mask_display ( ) ;
395+ assert_eq ! (
396+ masked_config. storage. as_ref( ) . unwrap( ) . s3. secret_access_key,
397+ "*************_key"
398+ ) ;
399+ assert_eq ! (
400+ masked_config. storage. as_ref( ) . unwrap( ) . s3. security_token,
401+ "***********ken"
402+ ) ;
403+ }
357404}
0 commit comments