Skip to content

ORC: Use MetricsConfig - #1339

Merged
shardulm94 merged 3 commits into
apache:masterfrom
edgarRd:orc--metrics-config
Aug 25, 2020
Merged

shardulm94 merged 3 commits into
apache:masterfrom
edgarRd:orc--metrics-config

Conversation

@edgarRd

@edgarRd edgarRd commented Aug 13, 2020

Copy link
Copy Markdown
Contributor

Unlike Parquet metrics, ORC was not using MetricsConfig to let the user configure which metrics to collect or truncate string column metrics.

This PR fixes #1268 by adding MetricsConfig support in ORC metrics. I've also added unit tests to TestMetrics, which runs for both Parquet and ORC, to check the different MetricsModes and the truncation of string and binary (not supported in ORC) columns.

PTAL @aokolnychyi @rdsr @shardulm94 Thanks!

@edgarRd edgarRd changed the title ORC: Use MetricsConfig for ORC metrics ORC: Use MetricsConfig Aug 13, 2020
@edgarRd
edgarRd force-pushed the orc--metrics-config branch from d1b81dd to 690127c Compare August 17, 2020 20:37
@edgarRd

edgarRd commented Aug 17, 2020

Copy link
Copy Markdown
Contributor Author

Friendly ping in this PR: @aokolnychyi @rdsr @rdblue Thanks!

@shardulm94 shardulm94 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor comments. LGTM otherwise


private static Object truncateIfNeeded(Bound bound, Type type, Object value, MetricsMode metricsMode) {
// ORC only stores min/max for String columns
if (value == null || metricsMode == MetricsModes.Full.get() || type.typeId() != Type.TypeID.STRING) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Might be better to check if the Metrics mode != Truncate, seems easier to read that way. Also we have a Precondition later to assert the same, which may be unnecessary if we make the check here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

@edgarRd

edgarRd commented Aug 20, 2020

Copy link
Copy Markdown
Contributor Author

Thanks for the review @shardulm94 - I've updated the PR.

@edgarRd
edgarRd force-pushed the orc--metrics-config branch from d43ee8b to eb116fb Compare August 20, 2020 17:33
@edgarRd

edgarRd commented Aug 24, 2020

Copy link
Copy Markdown
Contributor Author

@rdsr @aokolnychyi PTAL - do you have any comments?

@shardulm94

shardulm94 commented Aug 25, 2020 •

Copy link
Copy Markdown
Contributor

The PR looks good! Since this has been open for additional comments for a while now I am merging this. We can handle any followups in a separate PR. Thanks @edgarRd for the PR!

@shardulm94
shardulm94 merged commit 6e2692c into apache:master Aug 25, 2020
@edgarRd

edgarRd commented Aug 25, 2020

Copy link
Copy Markdown
Contributor Author

Thanks @shardulm94 !

parthchandra pushed a commit to parthchandra/iceberg that referenced this pull request Oct 22, 2025
* Apple 1.5.0.4 Release (apache#1339)

* Prepare 1.5.0.5-apple release

---------

Co-authored-by: Szehon Ho <[email protected]>
parthchandra pushed a commit to parthchandra/iceberg that referenced this pull request Oct 22, 2025
parthchandra pushed a commit to parthchandra/iceberg that referenced this pull request Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Respect MetricsConfig while importing ORC data

2 participants