Skip to content

GH-50910: [Parquet] Tolerate unrecognized logical/physical type combinations when reading - #50909

Open
divjotarora wants to merge 7 commits into
apache:mainfrom
divjotarora:log-phys-type-combo
Open

divjotarora wants to merge 7 commits into
apache:mainfrom
divjotarora:log-phys-type-combo

Conversation

@divjotarora

@divjotarora divjotarora commented Aug 18, 2026 •

Copy link
Copy Markdown

Rationale for this change

See apache/parquet-format#607 for rationale.

What changes are included in this PR?

This PR gracefully handles unrecognized logical/physical type combinations by dropping the logical type during the read and dropping any associated statistics for the relevant columns. Note that unrecognized logical types are already handled gracefully and no changes were required.

Are these changes tested?

Yes, via unit tests and an e2e test that reads a real file that contains an invalid type combination.

Are there any user-facing changes?

No

@github-actions

Copy link
Copy Markdown

Thanks for opening a pull request!

This pull request has been automatically converted to a draft because its title doesn't match Arrow's required format.

If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

After updating the title, you can mark the pull request as ready for review.

See also:

@github-actions
github-actions Bot marked this pull request as draft August 18, 2026 20:34
@divjotarora divjotarora changed the title Tolerate unrecognized logical/physical type combinations when reading GH-50910: Tolerate unrecognized logical/physical type combinations when reading Aug 18, 2026
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #50910 has been automatically assigned in GitHub to PR creator.

Comment thread cpp/submodules/parquet-testing
@divjotarora
divjotarora marked this pull request as ready for review August 18, 2026 23:58

@Reranko05 Reranko05 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.

Could you also add Component of the PR in the title, it will be easier for maintainers to review it.
GH-<Issue Number>: [<Component>] <Title>

@divjotarora divjotarora changed the title GH-50910: Tolerate unrecognized logical/physical type combinations when reading GH-50910: [Core] Tolerate unrecognized logical/physical type combinations when reading Aug 19, 2026
@divjotarora divjotarora changed the title GH-50910: [Core] Tolerate unrecognized logical/physical type combinations when reading GH-50910: [Format] Tolerate unrecognized logical/physical type combinations when reading Aug 19, 2026
@github-actions github-actions Bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Aug 20, 2026
@emkornfield emkornfield changed the title GH-50910: [Format] Tolerate unrecognized logical/physical type combinations when reading GH-50910: [Parquet] Tolerate unrecognized logical/physical type combinations when reading Aug 20, 2026
Comment thread cpp/src/parquet/schema.cc Outdated
Comment thread cpp/src/parquet/schema.cc

@emkornfield emkornfield 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.

a couple of questions, but seems reasonable.

Comment thread cpp/src/parquet/schema.cc
// type annotation.
if (logical_type &&
!logical_type->is_applicable(physical_type, element->type_length)) {
ARROW_LOG(WARNING) << "Dropping unsupported logical type "

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.

I think this might be the first log statement we have in Parquet code. @wgtmac @pitrou any concerns with adding it, it seems useful?

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.

I think this logging is worth adding if the behavior is not configurable.

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.

Hmm, I don't think I like the idea of logging "problems" like this, especially if the logging cannot be suppressed.

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.

@emkornfield @wgtmac Any thoughts on this?

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.

Also cc @HuaHuaY

The main purpose of this PR is to allow reading Parquet files that use features not yet implemented in Parquet C++ (a new logical/physical type combination).

We don't emit warnings for other unrecognized features, so I think it's reasonable to be silent here as well.

(warnings could come across as noisy, especially if the user cannot do anything about them)

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.

I have no strong opinion here, but isn't it better for a user to know that they're using a library that doesn't understand the full semantic meaning of the files they're reading? The results are still correct, but the library is not doing any skipping/pruning that it might otherwise do and realistically they should upgrade it (or fix their files in case it's the data that's wrong for some reason).

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.

I have no strong opinion here, but isn't it better for a user to know that they're using a library that doesn't understand the full semantic meaning of the files they're reading?

Either they care about those semantics and they will notice anyway (because the contents won't be read as the expected Arrow datatype: for example a TIMESTAMP FLBA(12) column would be read as FixedSizeBinary rather Timestamp), or they don't care about those semantics and the warning message is just a distraction.

realistically they should upgrade it

Only if there is a newer version of the library that supports said combination, and only if they can reasonably upgrade (perhaps they are using some application that links Parquet C++, and the upgrade cycle depends on the application's release cycle).

@emkornfield

Copy link
Copy Markdown
Contributor

Triggered workflows generally one question on logging that I'd like other input on, otherwise seems reasonable to be as long as CI passes.

@github-actions github-actions Bot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Sep 23, 2026
Comment thread cpp/src/parquet/schema.cc
// type annotation.
if (logical_type &&
!logical_type->is_applicable(physical_type, element->type_length)) {
ARROW_LOG(WARNING) << "Dropping unsupported logical type "

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.

I think this logging is worth adding if the behavior is not configurable.

Comment thread cpp/src/parquet/schema.cc Outdated
@github-actions github-actions Bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Sep 25, 2026
Comment thread cpp/src/parquet/schema.cc Outdated
Co-authored-by: Isaac <no-reply@databricks.com>
Comment thread cpp/src/parquet/schema.cc
size_t pos = 0;
size_t num_reserved = 0;

std::function<std::unique_ptr<Node>(int depth)> NextNode = [&](int depth) {

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.

The majority of the remove/add changes here are due to whitespace because of the addition of a const SchemaPath* parent_path parameter.

@emkornfield emkornfield 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.

Generally, LGTM, unless there are other comments, I think once other comments are addressed we can merge this (will aim to do so Monday unless there is additional feedback).

@emkornfield emkornfield 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.

it would be nice if we could test the nested case to ensure the new path naming works as intended.

@github-actions github-actions Bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Sep 25, 2026
Co-authored-by: Isaac <no-reply@databricks.com>
@github-actions github-actions Bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Sep 26, 2026
@divjotarora

Copy link
Copy Markdown
Author

it would be nice if we could test the nested case to ensure the new path naming works as intended.

Added a test to schema_test.cc

Comment thread cpp/src/parquet/schema_test.cc
@github-actions github-actions Bot added awaiting merge Awaiting merge and removed awaiting change review Awaiting change review labels Sep 28, 2026
@emkornfield

emkornfield commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

CI failure looks unrelated. Going to merge now (actually might be a little bit, need to reset up the merge script on my box).

Comment thread cpp/src/parquet/schema.h
public:
static std::unique_ptr<Node> FromParquet(const void* opaque_element);
static std::unique_ptr<Node> FromParquet(const void* opaque_element,
const SchemaPath* parent_path);

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.

Hmm, why are we exposing a public API that the user cannot call (because it expects an incomplete type)?

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.

I added this so Unflatten could call it. Maybe let's resolve the logging discussion first as this function is only needed to do the logging?

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.

If we decide to keep the logging, we could make this new overload private but still accessible from Unflatten:

PARQUET_EXPORT friend std::unique_ptr<Node> Unflatten(
      std::span<const format::SchemaElement> elements, int max_depth);

Let me know if you'd prefer this approach.

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.

5 participants