in crates/core/src/table/mod.rs [1117:1172]
fn hudi_table_get_file_slices_as_of_timestamps() {
let base_url = SampleTable::V6Nonpartitioned.url_to_cow();
let hudi_table = Table::new_blocking(base_url.path()).unwrap();
let file_slices = hudi_table
.get_file_slices_blocking(empty_filters())
.unwrap();
assert_eq!(
file_slices
.iter()
.map(|f| f.base_file_relative_path().unwrap())
.collect::<Vec<_>>(),
vec!["a079bdb3-731c-4894-b855-abfcd6921007-0_0-203-274_20240418173551906.parquet",]
);
// as of the latest timestamp
let hudi_table = Table::new_blocking(base_url.path()).unwrap();
let file_slices = hudi_table
.get_file_slices_as_of_blocking("20240418173551906", empty_filters())
.unwrap();
assert_eq!(
file_slices
.iter()
.map(|f| f.base_file_relative_path().unwrap())
.collect::<Vec<_>>(),
vec!["a079bdb3-731c-4894-b855-abfcd6921007-0_0-203-274_20240418173551906.parquet",]
);
// as of just smaller than the latest timestamp
let hudi_table =
Table::new_with_options_blocking(base_url.path(), empty_options()).unwrap();
let file_slices = hudi_table
.get_file_slices_as_of_blocking("20240418173551905", empty_filters())
.unwrap();
assert_eq!(
file_slices
.iter()
.map(|f| f.base_file_relative_path().unwrap())
.collect::<Vec<_>>(),
vec!["a079bdb3-731c-4894-b855-abfcd6921007-0_0-182-253_20240418173550988.parquet",]
);
// as of non-exist old timestamp
let hudi_table =
Table::new_with_options_blocking(base_url.path(), empty_options()).unwrap();
let file_slices = hudi_table
.get_file_slices_as_of_blocking("19700101000000", empty_filters())
.unwrap();
assert_eq!(
file_slices
.iter()
.map(|f| f.base_file_relative_path().unwrap())
.collect::<Vec<_>>(),
Vec::<String>::new()
);
}