Skip to content

feat(cache): Add CacheEntrySizePolicy to reuse shorter cache entries as prefixes - #19126

Open
kingcrimsontianyu wants to merge 8 commits into
facebookincubator:mainfrom
kingcrimsontianyu:cache-size-policy
Open

kingcrimsontianyu wants to merge 8 commits into
facebookincubator:mainfrom
kingcrimsontianyu:cache-size-policy

Conversation

@kingcrimsontianyu

@kingcrimsontianyu kingcrimsontianyu commented Sep 21, 2026 •

Copy link
Copy Markdown

Today findOrCreate treats an existing entry at the requested key as stale when the entry is shorter than the requested size. The entry is evicted and the whole range is loaded again, even though the shorter entry already holds a valid prefix of the requested bytes.

This PR adds a CacheEntrySizePolicy { kRequireAtLeast, kAllowSmaller } parameter to findOrCreate, defaulting to kRequireAtLeast so that current callers behave exactly as before. Under kAllowSmaller, the shorter entry is returned as a shared pin and counted as a hit. The caller reads the entry's actual size and requests the remaining bytes under a new key starting where the entry ends.

This PR is extracted from the WXD-launch integration branch (https://github.com/rapidsai/velox/tree/WXD-launch), where the cache size policy feature is originally made by @kjmph.

@netlify

netlify Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit cc6cf78
🔍 Latest deploy log https://app.netlify.com/projects/meta-velox/deploys/6ad66df381c09178d9d87e21

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 21, 2026
Co-authored-by: Kyle Hubert <kjmph@users.noreply.github.com>
@majetideepak

Copy link
Copy Markdown
Collaborator

Is there a reason to have a policy? Why not always reuse?

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kingcrimsontianyu

kingcrimsontianyu commented Oct 7, 2026 •

Copy link
Copy Markdown
Author

@majetideepak Sorry I forgot to reply. So my understanding is that a cache hit under the default kRequireAtLeast requires the request range <= the entry size, which is the natural definition of hit. And now under the new kAllowSmaller the cache is still considered hit when request range > the entry size, and it becomes the callers responsibility to fetch the unavailable bytes. If we universally enforce kAllowSmaller, it may break existing code, where the callers see the "hit" and proceed to read past the cache bytes.

cc @kjmph

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

Selective Build Plan

Linux release with adapters is running a selective build of 549 cmake targets (out of 628 total). See the CI workflows README for what this means.

Affected targets (549)

Directly changed (336)

Target Changed Files
aggregate_companion_functions_test AsyncDataCache.h
duck_query_runner_test AsyncDataCache.h
materialized_output_buffer_test AsyncDataCache.h
materialized_partitioned_output_test AsyncDataCache.h
presto_sql_test AsyncDataCache.h
spark_aggregation_fuzzer_test AsyncDataCache.h
spark_expression_fuzzer_test AsyncDataCache.h
velox_aggregates AsyncDataCache.h
velox_aggregates_GeometryAggregateTest AsyncDataCache.h
velox_aggregates_reduce_agg_bm AsyncDataCache.h
velox_aggregates_simple_aggregates_bm AsyncDataCache.h
velox_aggregates_string_keys_bm AsyncDataCache.h
velox_aggregates_test_group0 AsyncDataCache.h
velox_aggregates_test_group1 AsyncDataCache.h
velox_aggregates_test_group2 AsyncDataCache.h
velox_aggregates_test_group3 AsyncDataCache.h
velox_aggregates_test_group4 AsyncDataCache.h
velox_aggregation_fuzzer AsyncDataCache.h
velox_aggregation_fuzzer_base AsyncDataCache.h
velox_aggregation_fuzzer_test AsyncDataCache.h
velox_aggregation_result_verifier AsyncDataCache.h
velox_aggregation_runner_test AsyncDataCache.h
velox_arrow_bridge_test AsyncDataCache.h
velox_base_test AsyncDataCache.h
velox_benchmark_array_writer_no_nulls AsyncDataCache.h
velox_benchmark_array_writer_with_nulls AsyncDataCache.h
velox_benchmark_basic_comparison_conjunct AsyncDataCache.h
velox_benchmark_basic_decoded_vector AsyncDataCache.h
velox_benchmark_basic_preproc AsyncDataCache.h
velox_benchmark_basic_selectivity_vector AsyncDataCache.h
velox_benchmark_basic_simple_arithmetic AsyncDataCache.h
velox_benchmark_basic_simple_cast AsyncDataCache.h
velox_benchmark_basic_vector_compare AsyncDataCache.h
velox_benchmark_builder AsyncDataCache.h
velox_benchmark_estimate_flat_size AsyncDataCache.h
velox_benchmark_expr_flat_no_nulls AsyncDataCache.h
velox_benchmark_feature_normalization AsyncDataCache.h
velox_benchmark_local_remote_comparison AsyncDataCache.h
velox_benchmark_map_writer_no_nulls AsyncDataCache.h
velox_benchmark_map_writer_with_nulls AsyncDataCache.h
velox_benchmark_nested_array_writer_no_nulls AsyncDataCache.h
velox_benchmark_nested_array_writer_with_nulls AsyncDataCache.h
velox_cache_fuzzer_lib AsyncDataCache.h
velox_cache_test_group0 AsyncDataCache.h, AsyncDataCacheTest.cpp
velox_caching AsyncDataCache.cpp, AsyncDataCache.h
velox_cast_benchmark AsyncDataCache.h
velox_common_base AsyncDataCache.h
velox_connector AsyncDataCache.h
velox_connector_registry AsyncDataCache.h
velox_connector_test AsyncDataCache.h
velox_core AsyncDataCache.h
velox_core_plan_consistency_checker_test AsyncDataCache.h
velox_core_test AsyncDataCache.h
velox_coverage_util AsyncDataCache.h
velox_cursor AsyncDataCache.h
velox_date_extract_benchmark AsyncDataCache.h
velox_driver_test AsyncDataCache.h
velox_duckdb_conversion_test AsyncDataCache.h
velox_dwio_arrow_parquet_writer_test AsyncDataCache.h
velox_dwio_arrow_parquet_writer_test_lib AsyncDataCache.h
velox_dwio_cache_test AsyncDataCache.h
velox_dwio_common AsyncDataCache.h
velox_dwio_common_test AsyncDataCache.h
velox_dwio_common_test_utils AsyncDataCache.h
velox_dwio_dwrf_binary_stream_reader_test AsyncDataCache.h
velox_dwio_dwrf_buffered_output_stream_test AsyncDataCache.h
velox_dwio_dwrf_byte_rle_test AsyncDataCache.h
velox_dwio_dwrf_column_reader_test AsyncDataCache.h
velox_dwio_dwrf_compression_test AsyncDataCache.h
velox_dwio_dwrf_decompression_test AsyncDataCache.h
velox_dwio_dwrf_decryption_test AsyncDataCache.h
velox_dwio_dwrf_encryption_test AsyncDataCache.h
velox_dwio_dwrf_int_direct_test AsyncDataCache.h
velox_dwio_dwrf_reader AsyncDataCache.h
velox_dwio_dwrf_reader_base_test AsyncDataCache.h
velox_dwio_dwrf_reader_test AsyncDataCache.h
velox_dwio_dwrf_rle_test AsyncDataCache.h
velox_dwio_dwrf_rlev1_encoder_test AsyncDataCache.h
velox_dwio_dwrf_stripe_dictionary_cache_test AsyncDataCache.h
velox_dwio_dwrf_stripe_reader_base_test AsyncDataCache.h
velox_dwio_dwrf_stripe_stream_test AsyncDataCache.h
velox_dwio_dwrf_writer_test AsyncDataCache.h
velox_dwio_iceberg_reader_benchmark AsyncDataCache.h
velox_dwio_iceberg_reader_benchmark_lib AsyncDataCache.h
velox_dwio_native_parquet_reader AsyncDataCache.h
velox_dwio_orc_reader AsyncDataCache.h
velox_dwio_orc_reader_filter_test AsyncDataCache.h
velox_dwio_orc_reader_test AsyncDataCache.h
velox_dwio_parquet_common AsyncDataCache.h
velox_dwio_parquet_page_reader_test AsyncDataCache.h
velox_dwio_parquet_reader AsyncDataCache.h
velox_dwio_parquet_reader_benchmark AsyncDataCache.h
velox_dwio_parquet_reader_benchmark_lib AsyncDataCache.h
velox_dwio_parquet_reader_test AsyncDataCache.h
velox_dwio_parquet_table_scan_test AsyncDataCache.h
velox_dwio_parquet_test_base AsyncDataCache.h
velox_dwio_parquet_tpch_test AsyncDataCache.h
velox_dwio_text_reader AsyncDataCache.h
velox_dwio_text_reader_register AsyncDataCache.h
velox_dwrf_column_writer_index_test AsyncDataCache.h
velox_dwrf_column_writer_stats_test AsyncDataCache.h
velox_dwrf_column_writer_test AsyncDataCache.h
velox_dwrf_e2e_filter_test AsyncDataCache.h
velox_dwrf_e2e_reader_test AsyncDataCache.h
velox_dwrf_e2e_writer_test AsyncDataCache.h
velox_dwrf_test_utils AsyncDataCache.h
velox_example_expression_eval AsyncDataCache.h
velox_example_opaque_type AsyncDataCache.h
velox_example_operator_extensibility AsyncDataCache.h
velox_example_scan_orc AsyncDataCache.h
velox_example_simple_functions AsyncDataCache.h
velox_example_vector_reader_writer AsyncDataCache.h
velox_exchange_benchmark AsyncDataCache.h
velox_exchange_fuzzer AsyncDataCache.h
velox_exchange_transport_registry_test AsyncDataCache.h
velox_exec AsyncDataCache.h
velox_exec_SpatialJoinTest AsyncDataCache.h
velox_exec_bm_duplicate_project AsyncDataCache.h
velox_exec_infra_test AsyncDataCache.h
velox_exec_test_group0 AsyncDataCache.h
velox_exec_test_group1 AsyncDataCache.h
velox_exec_test_group2 AsyncDataCache.h
velox_exec_test_group3 AsyncDataCache.h
velox_exec_test_group4 AsyncDataCache.h
velox_exec_test_group5 AsyncDataCache.h
velox_exec_test_group6 AsyncDataCache.h
velox_exec_test_group7 AsyncDataCache.h
velox_exec_test_group8 AsyncDataCache.h
velox_exec_test_lib AsyncDataCache.h
velox_exec_util_test_group0 AsyncDataCache.h
velox_exec_vector_hasher_benchmark AsyncDataCache.h
velox_exec_window AsyncDataCache.h
velox_expression AsyncDataCache.h
velox_expression_fuzzer AsyncDataCache.h
velox_expression_fuzzer_test AsyncDataCache.h
velox_expression_fuzzer_unit_test AsyncDataCache.h
velox_expression_runner AsyncDataCache.h
velox_expression_runner_test AsyncDataCache.h
velox_expression_runner_unit_test AsyncDataCache.h
velox_expression_test AsyncDataCache.h
velox_expression_test_utility AsyncDataCache.h
velox_expression_verifier AsyncDataCache.h
velox_expression_verifier_unit_test AsyncDataCache.h
velox_filter_project_benchmark AsyncDataCache.h
velox_fixed_point_test AsyncDataCache.h
velox_format_datetime_benchmark AsyncDataCache.h
velox_function_dynamic AsyncDataCache.h
velox_function_dynamic_link_test AsyncDataCache.h
velox_function_err_dynamic AsyncDataCache.h
velox_function_non_default_dynamic AsyncDataCache.h
velox_function_registry AsyncDataCache.h
velox_function_registry_test AsyncDataCache.h
velox_functions_aggregates AsyncDataCache.h
velox_functions_aggregates_test AsyncDataCache.h
velox_functions_aggregates_test_lib AsyncDataCache.h
velox_functions_benchmarks_compare AsyncDataCache.h
velox_functions_benchmarks_row_writer_no_nulls AsyncDataCache.h
velox_functions_benchmarks_simdjson_function_with_expr AsyncDataCache.h
velox_functions_benchmarks_string_writer_no_nulls AsyncDataCache.h
velox_functions_benchmarks_url AsyncDataCache.h
velox_functions_iceberg AsyncDataCache.h
velox_functions_iceberg_test AsyncDataCache.h
velox_functions_lib AsyncDataCache.h
velox_functions_lib_test AsyncDataCache.h
velox_functions_prestosql AsyncDataCache.h
velox_functions_prestosql_benchmarks_array_contains AsyncDataCache.h
velox_functions_prestosql_benchmarks_array_join AsyncDataCache.h
velox_functions_prestosql_benchmarks_array_min_max AsyncDataCache.h
velox_functions_prestosql_benchmarks_array_position AsyncDataCache.h
velox_functions_prestosql_benchmarks_array_sum AsyncDataCache.h
velox_functions_prestosql_benchmarks_bitwise AsyncDataCache.h
velox_functions_prestosql_benchmarks_cardinality AsyncDataCache.h
velox_functions_prestosql_benchmarks_comparisons AsyncDataCache.h
velox_functions_prestosql_benchmarks_concat AsyncDataCache.h
velox_functions_prestosql_benchmarks_date_time AsyncDataCache.h
velox_functions_prestosql_benchmarks_field_reference AsyncDataCache.h
velox_functions_prestosql_benchmarks_generic AsyncDataCache.h
velox_functions_prestosql_benchmarks_in AsyncDataCache.h
velox_functions_prestosql_benchmarks_map_concat AsyncDataCache.h
velox_functions_prestosql_benchmarks_map_except AsyncDataCache.h
velox_functions_prestosql_benchmarks_map_input AsyncDataCache.h
velox_functions_prestosql_benchmarks_map_intersect AsyncDataCache.h
velox_functions_prestosql_benchmarks_map_subscript AsyncDataCache.h
velox_functions_prestosql_benchmarks_map_zip_with AsyncDataCache.h
velox_functions_prestosql_benchmarks_not AsyncDataCache.h
velox_functions_prestosql_benchmarks_regexp_replace AsyncDataCache.h
velox_functions_prestosql_benchmarks_row AsyncDataCache.h
velox_functions_prestosql_benchmarks_string_ascii_utf_functions AsyncDataCache.h
velox_functions_prestosql_benchmarks_uuid_cast AsyncDataCache.h
velox_functions_prestosql_benchmarks_width_bucket AsyncDataCache.h
velox_functions_prestosql_benchmarks_zip AsyncDataCache.h
velox_functions_prestosql_benchmarks_zip_with AsyncDataCache.h
velox_functions_prestosql_impl AsyncDataCache.h
velox_functions_remote AsyncDataCache.h
velox_functions_remote_client_test AsyncDataCache.h
velox_functions_remote_server AsyncDataCache.h
velox_functions_spark AsyncDataCache.h
velox_functions_spark_aggregates AsyncDataCache.h
velox_functions_spark_aggregates_test AsyncDataCache.h
velox_functions_spark_impl AsyncDataCache.h
velox_functions_spark_specialforms AsyncDataCache.h
velox_functions_spark_test AsyncDataCache.h
velox_functions_test AsyncDataCache.h
velox_functions_test_lib AsyncDataCache.h
velox_functions_util AsyncDataCache.h
velox_functions_window AsyncDataCache.h
velox_functions_window_test_lib AsyncDataCache.h
velox_fuzzer_connector AsyncDataCache.h
velox_fuzzer_connector_test AsyncDataCache.h
velox_fuzzer_util AsyncDataCache.h
velox_gcs_insert_test AsyncDataCache.h
velox_gcs_multiendpoints_test AsyncDataCache.h
velox_group_probe_benchmark AsyncDataCache.h
velox_hash_benchmark AsyncDataCache.h
velox_hash_join_build_benchmark AsyncDataCache.h
velox_hash_join_left_benchmark AsyncDataCache.h
velox_hash_join_list_result_benchmark AsyncDataCache.h
velox_hash_join_prepare_join_table_benchmark AsyncDataCache.h
velox_hash_join_right_semi_benchmark AsyncDataCache.h
velox_hdfs_insert_test AsyncDataCache.h
velox_hive_connector AsyncDataCache.h
velox_hive_connector_test AsyncDataCache.h
velox_hive_iceberg_changelog_test AsyncDataCache.h
velox_hive_iceberg_equality_delete_test AsyncDataCache.h
velox_hive_iceberg_geometry_test AsyncDataCache.h
velox_hive_iceberg_insert_test AsyncDataCache.h
velox_hive_iceberg_merge_sink_test AsyncDataCache.h
velox_hive_iceberg_splitreader AsyncDataCache.h
velox_hive_iceberg_test AsyncDataCache.h
velox_hive_paimon_connector AsyncDataCache.h
velox_hive_paimon_split AsyncDataCache.h
velox_hive_paimon_split_test AsyncDataCache.h
velox_hive_partition_function AsyncDataCache.h
velox_hive_partition_function_benchmark AsyncDataCache.h
velox_hive_writer_options_adapter_test AsyncDataCache.h
velox_in_10_min_demo AsyncDataCache.h
velox_is_null_functions AsyncDataCache.h
velox_join_fuzzer AsyncDataCache.h
velox_key_encoder AsyncDataCache.h
velox_key_encoder_test AsyncDataCache.h
velox_like_benchmark AsyncDataCache.h
velox_like_tpch_benchmark AsyncDataCache.h
velox_mark_distinct_fuzzer AsyncDataCache.h
velox_mark_distinct_fuzzer_lib AsyncDataCache.h
velox_mark_sorted_benchmark AsyncDataCache.h
velox_memory_arbitration_fuzzer AsyncDataCache.h
velox_memory_test AsyncDataCache.h
velox_merge_benchmark AsyncDataCache.h
velox_merge_join_stream_left_benchmark AsyncDataCache.h
velox_numeric_upcast_benchmark AsyncDataCache.h
velox_orderby_benchmark AsyncDataCache.h
velox_output_transport_registry_test AsyncDataCache.h
velox_overload_int_function_dynamic AsyncDataCache.h
velox_overload_varchar_function_dynamic AsyncDataCache.h
velox_overwrite_int_function_dynamic AsyncDataCache.h
velox_overwrite_varchar_function_dynamic AsyncDataCache.h
velox_parquet_e2e_filter_test AsyncDataCache.h
velox_parquet_writer_sink_test AsyncDataCache.h
velox_parquet_writer_test AsyncDataCache.h
velox_parse_parser AsyncDataCache.h
velox_parse_test AsyncDataCache.h
velox_parse_utils AsyncDataCache.h
velox_prefixsort_benchmark AsyncDataCache.h
velox_presto_types AsyncDataCache.h
velox_presto_types_fuzzer_utils AsyncDataCache.h
velox_presto_types_fuzzer_utils_test AsyncDataCache.h
velox_presto_types_test AsyncDataCache.h
velox_query_benchmark AsyncDataCache.h
velox_query_replayer AsyncDataCache.h
velox_query_trace_replayer_base AsyncDataCache.h
velox_re2_functions_benchmarks AsyncDataCache.h
velox_row_container_list_rows_benchmark AsyncDataCache.h
velox_row_number_fuzzer AsyncDataCache.h
velox_row_number_fuzzer_lib AsyncDataCache.h
velox_rows_streaming_window_benchmark AsyncDataCache.h
velox_rpc_aimd_under_load_test AsyncDataCache.h
velox_rpc_node_test AsyncDataCache.h
velox_rpc_operator AsyncDataCache.h
velox_rpc_operator_test AsyncDataCache.h
velox_rpc_plan_node_translator AsyncDataCache.h
velox_s3file_test AsyncDataCache.h
velox_s3insert_test AsyncDataCache.h
velox_s3metrics_test AsyncDataCache.h
velox_s3multiendpoints_test AsyncDataCache.h
velox_s3read_test AsyncDataCache.h
velox_s3registration_test AsyncDataCache.h
velox_simple_aggregate AsyncDataCache.h
velox_simple_aggregate_test AsyncDataCache.h
velox_sort_benchmark AsyncDataCache.h
velox_spark_function_registry_test AsyncDataCache.h
velox_spark_query_runner AsyncDataCache.h
velox_spark_query_runner_test AsyncDataCache.h
velox_spark_windows_test AsyncDataCache.h
velox_sparksql_benchmarks_cast AsyncDataCache.h
velox_sparksql_benchmarks_compare AsyncDataCache.h
velox_sparksql_benchmarks_from_json AsyncDataCache.h
velox_sparksql_benchmarks_get_funcs AsyncDataCache.h
velox_sparksql_benchmarks_hash AsyncDataCache.h
velox_sparksql_benchmarks_in AsyncDataCache.h
velox_sparksql_benchmarks_simd_compare AsyncDataCache.h
velox_sparksql_benchmarks_split AsyncDataCache.h
velox_sparksql_coverage AsyncDataCache.h
velox_spatial_join_benchmark AsyncDataCache.h
velox_spatial_join_fuzzer AsyncDataCache.h
velox_spill_fuzzer_base_lib AsyncDataCache.h
velox_spiller_aggregate_benchmark AsyncDataCache.h
velox_spiller_aggregate_benchmark_base AsyncDataCache.h
velox_spiller_join_benchmark AsyncDataCache.h
velox_spiller_join_benchmark_base AsyncDataCache.h
velox_streaming_aggregation_benchmark AsyncDataCache.h
velox_table_evolution_fuzzer_test AsyncDataCache.h
velox_text_reader_test AsyncDataCache.h
velox_text_writer_test AsyncDataCache.h
velox_tool_trace_test AsyncDataCache.h
velox_topn_row_number_fuzzer AsyncDataCache.h
velox_topn_row_number_fuzzer_lib AsyncDataCache.h
velox_tpcds_benchmark AsyncDataCache.h
velox_tpcds_benchmark_lib AsyncDataCache.h
velox_tpcds_connector AsyncDataCache.h
velox_tpcds_connector_test AsyncDataCache.h
velox_tpch_benchmark AsyncDataCache.h
velox_tpch_benchmark_lib AsyncDataCache.h
velox_tpch_connector AsyncDataCache.h
velox_tpch_connector_test AsyncDataCache.h
velox_tpch_speed_test AsyncDataCache.h
velox_trace AsyncDataCache.h
velox_window AsyncDataCache.h
velox_window_fuzzer AsyncDataCache.h
velox_window_fuzzer_test AsyncDataCache.h
velox_window_prefixsort_benchmark AsyncDataCache.h
velox_window_sub_partitioned_sort_benchmark AsyncDataCache.h
velox_windows_agg_test AsyncDataCache.h
velox_windows_rank_test AsyncDataCache.h
velox_windows_value_test AsyncDataCache.h
velox_writer_fuzzer AsyncDataCache.h
velox_writer_fuzzer_test AsyncDataCache.h

Transitively affected (213)

  • bias_vector_test
  • cached_factory_test
  • copy_benchmark
  • file_utils_test
  • physical_size_aggregator_test
  • simple_lru_cache_test
  • simple_vector_test
  • velox_abfs
  • velox_abfs_registration_test
  • velox_abfs_test
  • velox_arrow_bridge
  • velox_async_rpc_function
  • velox_async_rpc_function_registry
  • velox_async_rpc_function_registry_test
  • velox_benchmark_basic_vector_fuzzer
  • velox_benchmark_basic_vector_slice
  • velox_buffer
  • velox_buffer_test
  • velox_cache_fuzzer
  • velox_common_base_benchmarks
  • velox_common_compression_test
  • velox_common_encode_test
  • velox_common_fuzzer_util
  • velox_common_geospatial_serde
  • velox_common_geospatial_serde_test
  • velox_common_hyperloglog
  • velox_common_hyperloglog_dense_hll_bm
  • velox_common_hyperloglog_test
  • velox_common_indexed_priority_queue_benchmark
  • velox_common_io
  • velox_common_sorting_network_benchmark
  • velox_common_split_block_bloom_filter_benchmark
  • velox_common_stringsearch_benchmarks
  • velox_common_test
  • velox_concurrent_allocation_benchmark
  • velox_config_property
  • velox_config_test
  • velox_congestion_controller_test
  • velox_constrained_input_generators
  • velox_constrained_input_generators_test
  • velox_constrained_vector_generator
  • velox_constrained_vector_generator_test
  • velox_custom_memory_resource_registry
  • velox_date_conversion_benchmark
  • velox_demo_batch_rpc_function
  • velox_demo_rpc_function
  • velox_demo_rpc_function_test
  • velox_duckdb_conversion
  • velox_duckdb_parser
  • velox_dwio_arrow_parquet_writer
  • velox_dwio_arrow_parquet_writer_lib
  • velox_dwio_arrow_parquet_writer_util_lib
  • velox_dwio_catalog_fbhive
  • velox_dwio_common_bitpack_decoder_benchmark
  • velox_dwio_common_compression
  • velox_dwio_common_data_buffer_benchmark
  • velox_dwio_common_exception
  • velox_dwio_common_int_decoder_benchmark
  • velox_dwio_dwrf_byte_rle_encoder_test
  • velox_dwio_dwrf_checksum_test
  • velox_dwio_dwrf_column_statistics_test
  • velox_dwio_dwrf_common
  • velox_dwio_dwrf_config_test
  • velox_dwio_dwrf_data_buffer_holder_test
  • velox_dwio_dwrf_dictionary_encoder_test
  • velox_dwio_dwrf_dictionary_encoding_utils_test
  • velox_dwio_dwrf_encoding_selector_test
  • velox_dwio_dwrf_flush_policy_test
  • velox_dwio_dwrf_index_builder_test
  • velox_dwio_dwrf_int_encoder_test
  • velox_dwio_dwrf_layout_planner_test
  • velox_dwio_dwrf_ratio_checker_test
  • velox_dwio_dwrf_stream_labels_test
  • velox_dwio_dwrf_utils
  • velox_dwio_dwrf_utils_test
  • velox_dwio_dwrf_writer
  • velox_dwio_dwrf_writer_context_test
  • velox_dwio_dwrf_writer_encoding_manager_test
  • velox_dwio_dwrf_writer_sink_test
  • velox_dwio_faulty_file_sink
  • velox_dwio_orc_column_statistics_test
  • velox_dwio_parquet_boolean_decoder_benchmark
  • velox_dwio_parquet_common_test
  • velox_dwio_parquet_delta_bp_decoder_benchmark
  • velox_dwio_parquet_delta_bp_decoder_test
  • velox_dwio_parquet_metadata_benchmark
  • velox_dwio_parquet_rlebp_decoder_test
  • velox_dwio_parquet_structure_decoder_benchmark
  • velox_dwio_parquet_structure_decoder_test
  • velox_dwio_parquet_writer
  • velox_dwio_parquet_writer_benchmark
  • velox_dwio_text_writer
  • velox_dwio_text_writer_register
  • velox_dwrf_float_column_writer_benchmark
  • velox_dwrf_int_encoder_benchmark
  • velox_dwrf_statistics_builder_utils_test
  • velox_dwrf_writer_extended_test
  • velox_dwrf_writer_flush_test
  • velox_dynamic_library_loader
  • velox_exception
  • velox_exec_prefixsort_test
  • velox_exec_prefixsort_test_lib
  • velox_exec_spill_stats
  • velox_expression_functions
  • velox_expression_fuzzer_test_utility
  • velox_file_test
  • velox_file_test_utils
  • velox_filemetadata_test
  • velox_filter_benchmark
  • velox_fragmentation_benchmark
  • velox_functions_geo
  • velox_functions_iceberg_hash
  • velox_functions_json
  • velox_functions_json_test
  • velox_functions_lib_date_time_formatter
  • velox_functions_remote_get_serde
  • velox_functions_remote_server_main
  • velox_functions_remote_utils
  • velox_functions_sfm
  • velox_functions_sfm_test
  • velox_functions_spark_window
  • velox_functions_string_test
  • velox_gcs
  • velox_gcs_file_test
  • velox_gcsfile_example
  • velox_hdfs
  • velox_hdfs_file_test
  • velox_hdfs_read_file_test
  • velox_hierarchical_timer
  • velox_hierarchical_timer_test
  • velox_hive_config
  • velox_hive_iceberg_deletion_vector_test
  • velox_hive_iceberg_deletion_vector_writer_test
  • velox_hive_iceberg_merge_processor_test
  • velox_hive_iceberg_session_credentials_test
  • velox_hive_paimon_data_file_meta_test
  • velox_hive_paimon_deletion_file_test
  • velox_hive_paimon_row_kind_test
  • velox_id_map
  • velox_id_map_test
  • velox_memcpy_meter
  • velox_negated_bigint_range_benchmark
  • velox_negated_bytes_range_benchmark
  • velox_negated_bytes_values_benchmark
  • velox_negated_values_filter_benchmark
  • velox_orderby_benchmark_util
  • velox_parse_expression
  • velox_prefix_sort_algorithm_benchmark
  • velox_presto_coercions
  • velox_presto_coercions_test
  • velox_presto_query_config
  • velox_presto_serializer
  • velox_presto_type_parser
  • velox_presto_type_parser_test
  • velox_prestosql_coverage
  • velox_process_test
  • velox_query_config_provider
  • velox_query_config_provider_test
  • velox_read_benchmark
  • velox_read_benchmark_lib
  • velox_response_simulator
  • velox_row_fast
  • velox_row_serializer_benchmark
  • velox_row_test
  • velox_rpc_error_classification
  • velox_rpc_error_classification_test
  • velox_rpc_rate_limiter
  • velox_rpc_rate_limiter_test
  • velox_rpc_state
  • velox_rpc_state_test
  • velox_rpc_types
  • velox_s3config_test
  • velox_s3finalize_test
  • velox_s3fs
  • velox_scoped_registry_test
  • velox_serialization_test
  • velox_serializer_benchmark
  • velox_serializer_test_group0
  • velox_signature_parser
  • velox_signature_parser_test
  • velox_spark_query_config
  • velox_string_core_benchmark
  • velox_string_view_benchmark
  • velox_test_util_test
  • velox_time_test
  • velox_tpcds_append_info
  • velox_tpcds_dsdgen
  • velox_tpcds_gen
  • velox_tpcds_gen_test
  • velox_tpch_gen
  • velox_tpch_gen_test
  • velox_trace_file_tool
  • velox_trace_file_tool_base
  • velox_tracked_executor
  • velox_type_calculation
  • velox_type_fbhive
  • velox_type_fbhive_test
  • velox_type_serializer_fbhive_test
  • velox_type_signature
  • velox_type_test
  • velox_type_tz_ext_invalid_test
  • velox_type_tz_test
  • velox_unsafe_row_serialize_benchmark
  • velox_vector
  • velox_vector_flat_map_vector_benchmark
  • velox_vector_fuzzer
  • velox_vector_fuzzer_test
  • velox_vector_fuzzer_util
  • velox_vector_hash_all_benchmark
  • velox_vector_map_update_benchmark
  • velox_vector_selectivity_vector_benchmark
  • velox_vector_test
  • velox_vector_test_lib

Fast path • Graph from main@485e24f05450

@majetideepak

Copy link
Copy Markdown
Collaborator

@kingcrimsontianyu Is it accurate that kAllowSmaller is not supported on the CPU? I don't see any logic where a read is issued only for the uncached portion.

@kingcrimsontianyu

Copy link
Copy Markdown
Author

@majetideepak Right, the new kAllowSmaller is unused by the CPU readers. The only caller is the cuDF KvikIO datasource in #18941. (In my earlier comment, both kRequireAtLeast mentions should have said kAllowSmaller.)

@majetideepak majetideepak left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kingcrimsontianyu this makes sense. Just one more comment.

ASSERT_EQ(stats.numStales, 1);
ASSERT_EQ(stats.numEntries, 1);
ASSERT_EQ(stats.numHit, 1);
ASSERT_EQ(stats.numHit, 2);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would this change to 2?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So cache_->refreshStats(); accumulates the statistics. We inserted a small chunk of test above, where under kAllowSmaller a hit happened, making the counter 2. Here the counter stays 2.

@majetideepak majetideepak Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kingcrimsontianyu let's reset the stats before each chunk so we can test independently. Thanks!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@majetideepak Thanks. I feel that the original two (now three) chunks of tests are placed one after another intentionally, so instead of placing them in independent tests, I asserted on the stats delta (using CacheStats::operator-) for each chunk to have the same effect of "stats resetting". Let me know if the test now is what you have in mind.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kingcrimsontianyu Your current test change is under TEST_P(AsyncDataCacheTest, staleEntry). This PR should get its own test TEST_P(AsyncDataCacheTest, cacheEntrySizePolicy)?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Used a separate test cacheEntrySizePolicy.

@majetideepak

Copy link
Copy Markdown
Collaborator

@xiaoxmeng, @oerling, @Yuhta any comments from you?

@majetideepak majetideepak left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This API extension makes sense. It trades a new read vs more cache entries.
I will wait for a day or two for @xiaoxmeng to respond as well.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants