@@ -132,12 +132,12 @@ impl Scheme for FormatRecordingScheme {
132132
133133 fn compress (
134134 & self ,
135- compressor : & CascadingCompressor ,
135+ _compressor : & CascadingCompressor ,
136136 data : & ArrayAndStats ,
137- _compress_ctx : CompressorContext ,
137+ compress_ctx : CompressorContext ,
138138 _exec_ctx : & mut ExecutionCtx ,
139139 ) -> VortexResult < ArrayRef > {
140- * SEEN_FORMAT . lock ( ) = Some ( compressor . allows_serialized_id ( Constant . id ( ) ) ) ;
140+ * SEEN_FORMAT . lock ( ) = Some ( compress_ctx . allows_serialized_id ( Constant . id ( ) ) ) ;
141141 Ok ( data. array ( ) . clone ( ) )
142142 }
143143}
@@ -420,8 +420,12 @@ fn immediate_always_use_wins_immediately() -> VortexResult<()> {
420420 let data = estimate_test_data ( ) ;
421421 let mut exec_ctx = SESSION . create_execution_ctx ( ) ;
422422
423- let winner =
424- compressor. choose_best_scheme ( & schemes, & data, CompressorContext :: new ( ) , & mut exec_ctx) ?;
423+ let winner = compressor. choose_best_scheme (
424+ & schemes,
425+ & data,
426+ CompressorContext :: new ( None ) ,
427+ & mut exec_ctx,
428+ ) ?;
425429
426430 assert ! ( matches!(
427431 winner,
@@ -438,8 +442,12 @@ fn callback_always_use_wins_immediately() -> VortexResult<()> {
438442 let data = estimate_test_data ( ) ;
439443 let mut exec_ctx = SESSION . create_execution_ctx ( ) ;
440444
441- let winner =
442- compressor. choose_best_scheme ( & schemes, & data, CompressorContext :: new ( ) , & mut exec_ctx) ?;
445+ let winner = compressor. choose_best_scheme (
446+ & schemes,
447+ & data,
448+ CompressorContext :: new ( None ) ,
449+ & mut exec_ctx,
450+ ) ?;
443451
444452 assert ! ( matches!(
445453 winner,
@@ -456,8 +464,12 @@ fn callback_skip_is_ignored() -> VortexResult<()> {
456464 let data = estimate_test_data ( ) ;
457465 let mut exec_ctx = SESSION . create_execution_ctx ( ) ;
458466
459- let winner =
460- compressor. choose_best_scheme ( & schemes, & data, CompressorContext :: new ( ) , & mut exec_ctx) ?;
467+ let winner = compressor. choose_best_scheme (
468+ & schemes,
469+ & data,
470+ CompressorContext :: new ( None ) ,
471+ & mut exec_ctx,
472+ ) ?;
461473
462474 assert ! ( matches!(
463475 winner,
@@ -474,8 +486,12 @@ fn callback_ratio_competes_numerically() -> VortexResult<()> {
474486 let data = estimate_test_data ( ) ;
475487 let mut exec_ctx = SESSION . create_execution_ctx ( ) ;
476488
477- let winner =
478- compressor. choose_best_scheme ( & schemes, & data, CompressorContext :: new ( ) , & mut exec_ctx) ?;
489+ let winner = compressor. choose_best_scheme (
490+ & schemes,
491+ & data,
492+ CompressorContext :: new ( None ) ,
493+ & mut exec_ctx,
494+ ) ?;
479495
480496 assert ! ( matches!(
481497 winner,
@@ -492,8 +508,12 @@ fn zero_byte_sample_loses_to_finite_ratio() -> VortexResult<()> {
492508 let data = estimate_test_data ( ) ;
493509 let mut exec_ctx = SESSION . create_execution_ctx ( ) ;
494510
495- let winner =
496- compressor. choose_best_scheme ( & schemes, & data, CompressorContext :: new ( ) , & mut exec_ctx) ?;
511+ let winner = compressor. choose_best_scheme (
512+ & schemes,
513+ & data,
514+ CompressorContext :: new ( None ) ,
515+ & mut exec_ctx,
516+ ) ?;
497517
498518 assert ! ( matches!(
499519 winner,
@@ -510,8 +530,12 @@ fn finite_ratio_displaces_zero_byte_sample() -> VortexResult<()> {
510530 let data = estimate_test_data ( ) ;
511531 let mut exec_ctx = SESSION . create_execution_ctx ( ) ;
512532
513- let winner =
514- compressor. choose_best_scheme ( & schemes, & data, CompressorContext :: new ( ) , & mut exec_ctx) ?;
533+ let winner = compressor. choose_best_scheme (
534+ & schemes,
535+ & data,
536+ CompressorContext :: new ( None ) ,
537+ & mut exec_ctx,
538+ ) ?;
515539
516540 assert ! ( matches!(
517541 winner,
@@ -528,8 +552,12 @@ fn zero_byte_sample_alone_selects_no_scheme() -> VortexResult<()> {
528552 let data = estimate_test_data ( ) ;
529553 let mut exec_ctx = SESSION . create_execution_ctx ( ) ;
530554
531- let winner =
532- compressor. choose_best_scheme ( & schemes, & data, CompressorContext :: new ( ) , & mut exec_ctx) ?;
555+ let winner = compressor. choose_best_scheme (
556+ & schemes,
557+ & data,
558+ CompressorContext :: new ( None ) ,
559+ & mut exec_ctx,
560+ ) ?;
533561
534562 assert ! ( winner. is_none( ) ) ;
535563 Ok ( ( ) )
@@ -630,8 +658,12 @@ fn callback_always_use_overrides_pass_one_best() -> VortexResult<()> {
630658 let data = estimate_test_data ( ) ;
631659 let mut exec_ctx = SESSION . create_execution_ctx ( ) ;
632660
633- let winner =
634- compressor. choose_best_scheme ( & schemes, & data, CompressorContext :: new ( ) , & mut exec_ctx) ?;
661+ let winner = compressor. choose_best_scheme (
662+ & schemes,
663+ & data,
664+ CompressorContext :: new ( None ) ,
665+ & mut exec_ctx,
666+ ) ?;
635667
636668 assert ! ( matches!(
637669 winner,
@@ -651,7 +683,7 @@ fn threshold_reflects_pass_one_best() -> VortexResult<()> {
651683 let data = estimate_test_data ( ) ;
652684 let mut exec_ctx = SESSION . create_execution_ctx ( ) ;
653685
654- compressor. choose_best_scheme ( & schemes, & data, CompressorContext :: new ( ) , & mut exec_ctx) ?;
686+ compressor. choose_best_scheme ( & schemes, & data, CompressorContext :: new ( None ) , & mut exec_ctx) ?;
655687
656688 let observed = * OBSERVED_THRESHOLD . lock ( ) ;
657689 assert ! ( matches!(
@@ -672,7 +704,7 @@ fn threshold_is_none_when_only_prior_is_zero_bytes() -> VortexResult<()> {
672704 let data = estimate_test_data ( ) ;
673705 let mut exec_ctx = SESSION . create_execution_ctx ( ) ;
674706
675- compressor. choose_best_scheme ( & schemes, & data, CompressorContext :: new ( ) , & mut exec_ctx) ?;
707+ compressor. choose_best_scheme ( & schemes, & data, CompressorContext :: new ( None ) , & mut exec_ctx) ?;
676708
677709 // The observing callback was invoked (outer `Some`) and `best_so_far` was `None` (inner
678710 // `None`) because the zero-byte sample is never stored as the best.
@@ -691,7 +723,7 @@ fn threshold_is_none_when_no_prior_scheme() -> VortexResult<()> {
691723 let data = estimate_test_data ( ) ;
692724 let mut exec_ctx = SESSION . create_execution_ctx ( ) ;
693725
694- compressor. choose_best_scheme ( & schemes, & data, CompressorContext :: new ( ) , & mut exec_ctx) ?;
726+ compressor. choose_best_scheme ( & schemes, & data, CompressorContext :: new ( None ) , & mut exec_ctx) ?;
695727
696728 let observed = * OBSERVED_THRESHOLD . lock ( ) ;
697729 assert_eq ! ( observed, Some ( None ) ) ;
@@ -711,7 +743,7 @@ fn threshold_updates_from_earlier_deferred_callback() -> VortexResult<()> {
711743 let data = estimate_test_data ( ) ;
712744 let mut exec_ctx = SESSION . create_execution_ctx ( ) ;
713745
714- compressor. choose_best_scheme ( & schemes, & data, CompressorContext :: new ( ) , & mut exec_ctx) ?;
746+ compressor. choose_best_scheme ( & schemes, & data, CompressorContext :: new ( None ) , & mut exec_ctx) ?;
715747
716748 let observed = * OBSERVED_THRESHOLD . lock ( ) ;
717749 assert ! ( matches!(
@@ -732,8 +764,12 @@ fn ratio_tie_between_immediate_and_deferred_favors_immediate() -> VortexResult<(
732764 let data = estimate_test_data ( ) ;
733765 let mut exec_ctx = SESSION . create_execution_ctx ( ) ;
734766
735- let winner =
736- compressor. choose_best_scheme ( & schemes, & data, CompressorContext :: new ( ) , & mut exec_ctx) ?;
767+ let winner = compressor. choose_best_scheme (
768+ & schemes,
769+ & data,
770+ CompressorContext :: new ( None ) ,
771+ & mut exec_ctx,
772+ ) ?;
737773
738774 assert ! ( matches!(
739775 winner,
@@ -780,7 +816,7 @@ fn sampling_uses_scheme_stats_options() -> VortexResult<()> {
780816 // A context with default stats_options (count_distinct_values = false) and
781817 // marked as a sample so the function skips the sampling step and compresses
782818 // the array directly.
783- let ctx = CompressorContext :: new ( ) . with_sampling ( ) ;
819+ let ctx = CompressorContext :: new ( None ) . with_sampling ( ) ;
784820
785821 // Before the fix this panicked with:
786822 // "this must be present since `DictScheme` declared that we need distinct values"
@@ -891,19 +927,27 @@ fn map_compression_preserves_repeated_entry_children() -> VortexResult<()> {
891927#[ test]
892928fn allowed_serialized_ids_default_to_everything_and_intersect ( ) {
893929 let compressor = compressor ( ) ;
894- assert ! ( compressor. allows_serialized_id( Constant . id( ) ) ) ;
895- assert ! ( compressor. allows_serialized_id( Bool . id( ) ) ) ;
930+ let root = compressor. root_context ( ) ;
931+ assert ! ( root. allows_serialized_id( Constant . id( ) ) ) ;
932+ assert ! ( root. allows_serialized_id( Bool . id( ) ) ) ;
896933
897934 let restricted =
898935 compressor. with_allowed_serialized_ids ( HashSet :: from ( [ Primitive . id ( ) , Constant . id ( ) ] ) ) ;
899- assert ! ( restricted. allows_serialized_id( Constant . id( ) ) ) ;
900- assert ! ( !restricted. allows_serialized_id( Bool . id( ) ) ) ;
936+ let root = restricted. root_context ( ) ;
937+ assert ! ( root. allows_serialized_id( Constant . id( ) ) ) ;
938+ assert ! ( !root. allows_serialized_id( Bool . id( ) ) ) ;
901939
902940 let narrowed =
903941 restricted. with_allowed_serialized_ids ( HashSet :: from ( [ Primitive . id ( ) , Bool . id ( ) ] ) ) ;
904- assert ! ( narrowed. allows_serialized_id( Primitive . id( ) ) ) ;
905- assert ! ( !narrowed. allows_serialized_id( Constant . id( ) ) ) ;
906- assert ! ( !narrowed. allows_serialized_id( Bool . id( ) ) ) ;
942+ let root = narrowed. root_context ( ) ;
943+ assert ! ( root. allows_serialized_id( Primitive . id( ) ) ) ;
944+ assert ! ( !root. allows_serialized_id( Constant . id( ) ) ) ;
945+ assert ! ( !root. allows_serialized_id( Bool . id( ) ) ) ;
946+
947+ // Descending keeps the set.
948+ let child = root. descend_with_scheme ( IntDictScheme . id ( ) , 0 ) ;
949+ assert ! ( child. allows_serialized_id( Primitive . id( ) ) ) ;
950+ assert ! ( !child. allows_serialized_id( Constant . id( ) ) ) ;
907951}
908952
909953/// A scheme sees the restriction through the compressor it is handed: everything is allowed until
0 commit comments