400454 {
400455 auto &analyze_state = state_p.Cast<DictionaryCompressionAnalyzeState>();
400456 auto &state = *analyze_state.analyze_state;
400457
400458 if (state.current_tuple_count != 0) {
400459 state.UpdateMaxUniqueCount();
400460 }
400461
400462 auto width = BitpackingPrimitives::MinimumBitWidth(state.current_unique_count + 1);
400463 auto req_space = DictionaryCompression::RequiredSpace(state.current_tuple_count, state.current_unique_count,
400464 state.current_dict_size, width);
400465
400466 const auto total_space = state.segment_count * state.info.GetBlockSize() + req_space;
400467 return LossyNumericCast<idx_t>(DictionaryCompression::MINIMUM_COMPRESSION_RATIO * float(total_space));
400468}