Skip to content

fix: respect inexact flags in row group metadata - #16412

Merged
alamb merged 3 commits into
apache:mainfrom
CookiePieWw:respect-row-group-exactness-flags
Aug 18, 2025
Merged

fix: respect inexact flags in row group metadata#16412
alamb merged 3 commits into
apache:mainfrom
CookiePieWw:respect-row-group-exactness-flags

Conversation

@CookiePieWw

@CookiePieWwCookiePieWw commented Jun 14, 2025

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

Currently, datafusion will treat all max and min values in column stats as exact, while some of them may be inexact.

What changes are included in this PR?

For each row group, when max or min value is calculated, retrieve its corresponding exactness flag. The final max or min value's exactness represents the final exactness flag. Wrap the max and min stats with Inexact or Exact based on the final exactness flag

Are these changes tested?

Are there any user-facing changes?

Now datafusion will correctly report the exactness of column max and min values.

@github-actionsgithub-actionsBot added core Core DataFusion crate datasource Changes to the datasource crate labels Jun 14, 2025
@CookiePieWwCookiePieWw changed the title fix: respect inexact flags in row group metadata[WIP] fix: respect inexact flags in row group metadataJun 14, 2025
@github-actions

Copy link
Copy Markdown

Thank you for your contribution. Unfortunately, this pull request is stale because it has been open 60 days with no activity. Please remove the stale label or comment or this will be closed in 7 days.

@github-actionsgithub-actionsBot added the Stale PR has not had any activity for some time label Aug 14, 2025
@CookiePieWw
CookiePieWwforce-pushed the respect-row-group-exactness-flags branch 2 times, most recently from 27eeff3 to 27b4595CompareAugust 14, 2025 15:16
@github-actionsgithub-actionsBot added the functions Changes to functions implementation label Aug 14, 2025
@CookiePieWwCookiePieWw changed the title [WIP] fix: respect inexact flags in row group metadatafix: respect inexact flags in row group metadataAug 14, 2025
@CookiePieWw
CookiePieWwforce-pushed the respect-row-group-exactness-flags branch 2 times, most recently from 1eaac41 to c43f1deCompareAugust 15, 2025 07:33
@CookiePieWw

Copy link
Copy Markdown
ContributorAuthor

Hi @alamb, this pr tried to extract the exactness flags in row group metadata, could you please take a look :)

@CookiePieWw
CookiePieWwforce-pushed the respect-row-group-exactness-flags branch from c43f1de to bf10479CompareAugust 15, 2025 08:01
/// The value `0` appears at indices `[0, 2, 4]`. The corresponding exactness
/// values are `[true, false, false]`. Since at least one is `true`, the
/// function returns `Some(true)`.
fn has_any_exact_match(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we have a test for this?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Updated a unit test with 4 possible scenarios. Also use a struct to make clippy happy, PTAL :)

@xudong963xudong963 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you, this is a good finding and nice fix!

@github-actionsgithub-actionsBot removed the Stale PR has not had any activity for some time label Aug 16, 2025
@alamb
alamb merged commit afc90f7 into apache:mainAug 18, 2025
27 checks passed
@alamb

Copy link
Copy Markdown
Contributor

Thank you @xudong963 and @CookiePieWw

@CookiePieWw
CookiePieWw deleted the respect-row-group-exactness-flags branch August 18, 2025 15:32
LiaCastaneda added a commit to DataDog/datafusion that referenced this pull request Sep 23, 2025
LiaCastaneda added a commit to DataDog/datafusion that referenced this pull request Sep 23, 2025
LiaCastaneda added a commit to DataDog/datafusion that referenced this pull request Sep 23, 2025
LiaCastaneda added a commit to DataDog/datafusion that referenced this pull request Sep 30, 2025
LiaCastaneda added a commit to DataDog/datafusion that referenced this pull request Sep 30, 2025
* Revert "Upgrade arrow/parquet to 56.0.0 (apache#16690)"
This reverts commit fa1f8c1.
* Revert "refactor: use upstream inline_key_fast (apache#17044)"
This reverts commit 71b92bc.
* Revert "fix: respect inexact flags in row group metadata (apache#16412)"
This reverts commit afc90f7.
* Revert "Test grouping by FixedSizeList (apache#17415)"
This reverts commit 03f39e5.
* Spelling (got reverted)
* Also allow Byt from tests
* Adjust sqllogictests
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

coreCore DataFusion cratedatasourceChanges to the datasource cratefunctionsChanges to functions implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Treat truncated parquet stats as inexact

3 participants

@CookiePieWw@alamb@xudong963