Skip to content

[WIP] fix: respect inexact flags in row group metadata #16412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 28 additions & 44 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@ ahash = { version = "0.8", default-features = false, features = [
"runtime-rng",
] }
apache-avro = { version = "0.17", default-features = false }
arrow = { version = "55.1.0", features = [
arrow = { git = "https://github.com/apache/arrow-rs.git", rev = "1029974bc0f03b8adb089bfa8cc8f0ee96701866", features = [
"prettyprint",
"chrono-tz",
] }
arrow-buffer = { version = "55.0.0", default-features = false }
arrow-flight = { version = "55.1.0", features = [
arrow-buffer = { git = "https://github.com/apache/arrow-rs.git", rev = "1029974bc0f03b8adb089bfa8cc8f0ee96701866", default-features = false }
arrow-flight = { git = "https://github.com/apache/arrow-rs.git", rev = "1029974bc0f03b8adb089bfa8cc8f0ee96701866", features = [
"flight-sql-experimental",
] }
arrow-ipc = { version = "55.0.0", default-features = false, features = [
arrow-ipc = { git = "https://github.com/apache/arrow-rs.git", rev = "1029974bc0f03b8adb089bfa8cc8f0ee96701866", default-features = false, features = [
"lz4",
] }
arrow-ord = { version = "55.0.0", default-features = false }
arrow-schema = { version = "55.0.0", default-features = false }
arrow-ord = { git = "https://github.com/apache/arrow-rs.git", rev = "1029974bc0f03b8adb089bfa8cc8f0ee96701866", default-features = false }
arrow-schema = { git = "https://github.com/apache/arrow-rs.git", rev = "1029974bc0f03b8adb089bfa8cc8f0ee96701866", default-features = false }
async-trait = "0.1.88"
bigdecimal = "0.4.8"
bytes = "1.10"
Expand Down Expand Up @@ -151,7 +151,7 @@ itertools = "0.14"
log = "^0.4"
object_store = { version = "0.12.0", default-features = false }
parking_lot = "0.12"
parquet = { version = "55.1.0", default-features = false, features = [
parquet = { git = "https://github.com/apache/arrow-rs.git", rev = "1029974bc0f03b8adb089bfa8cc8f0ee96701866", default-features = false, features = [
"arrow",
"async",
"object_store",
Expand Down
31 changes: 30 additions & 1 deletion datafusion/core/tests/parquet/file_statistics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use datafusion::execution::context::SessionState;
use datafusion::execution::session_state::SessionStateBuilder;
use datafusion::prelude::SessionContext;
use datafusion_common::stats::Precision;
use datafusion_common::DFSchema;
use datafusion_common::{DFSchema, ScalarValue};
use datafusion_execution::cache::cache_manager::CacheManagerConfig;
use datafusion_execution::cache::cache_unit::{
DefaultFileStatisticsCache, DefaultListFilesCache,
Expand Down Expand Up @@ -99,6 +99,35 @@ async fn check_stats_precision_with_filter_pushdown() {
);
}

#[tokio::test]
async fn check_stats_inexact_for_truncated_values() {
let filename = "long_strings.parquet";
let table_path = ListingTableUrl::parse(filename).unwrap();

let opt =
ListingOptions::new(Arc::new(ParquetFormat::default())).with_collect_stat(true);
let table = get_listing_table(&table_path, None, &opt).await;

let (_, _, state) = get_cache_runtime_state();

let exec = table.scan(&state, None, &[], None).await.unwrap();
assert_eq!(
exec.partition_statistics(None).unwrap().num_rows,
Precision::Exact(2),
"Stats without filter should be exact"
);

let col_stats = &exec.partition_statistics(None).unwrap().column_statistics[0];
assert_eq!(
col_stats.min_value,
Precision::Inexact(ScalarValue::Utf8View(Some("A".repeat(4096))))
);
assert_eq!(
col_stats.max_value,
Precision::Inexact(ScalarValue::Utf8View(Some("Z".repeat(4095) + "[")))
);
}

#[tokio::test]
async fn load_table_stats_with_session_level_cache() {
let testdata = datafusion::test_util::parquet_test_data();
Expand Down
Loading
Loading