Skip to content

GH-49114: [C++][Parquet] Fix converting schema failure with deep nested two-level encoding list structure#49125

Merged
wgtmac merged 1 commit into
apache:mainfrom
HuaHuaY:fix_issue_49114
Feb 21, 2026
Merged

GH-49114: [C++][Parquet] Fix converting schema failure with deep nested two-level encoding list structure#49125
wgtmac merged 1 commit into
apache:mainfrom
HuaHuaY:fix_issue_49114

Conversation

@HuaHuaY

@HuaHuaY HuaHuaY commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

Fix the failure when converting parquet schema with deep nested two-level encoding list structure to arrow schema.

What changes are included in this PR?

Modified the ListToSchemaField and MapToSchemaField methods.

Are these changes tested?

Yes.

Are there any user-facing changes?

It allows some legal schemas that were once considered illegal.

@HuaHuaY

HuaHuaY commented Feb 3, 2026

Copy link
Copy Markdown
Contributor Author

@pitrou @emkornfield @wgtmac Please take a look.

Copilot AI 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.

Pull request overview

Fixes Parquet-to-Arrow schema conversion for deep nested two-level encoding LIST structures (and related MAP-in-LIST cases) that previously errored as illegal.

Changes:

  • Refactors list element resolution into a new ResolveList() helper to better handle nested two-level LIST encodings.
  • Relaxes repetition constraints to allow LIST/MAP nodes to be REPEATED when they are elements of an enclosing LIST.
  • Adds/updates unit tests to cover deep nested two-level LISTs and two-level LIST-of-MAP schemas, and adjusts expected error text.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
cpp/src/parquet/arrow/schema.cc Adjusts LIST/MAP schema conversion logic and introduces ResolveList() for nested/two-level handling.
cpp/src/parquet/arrow/arrow_schema_test.cc Adds coverage for deep nested two-level LIST and allows previously-failing LIST-of-MAP case; updates an error expectation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cpp/src/parquet/arrow/schema.cc

Copilot AI 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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cpp/src/parquet/arrow/schema.cc Outdated
@github-actions github-actions Bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Feb 4, 2026
@HuaHuaY
HuaHuaY requested a review from Copilot February 4, 2026 11:36

Copilot AI 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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@HuaHuaY
HuaHuaY force-pushed the fix_issue_49114 branch 2 times, most recently from d9eb0dc to 4f7558f Compare February 9, 2026 02:45
Comment thread cpp/src/parquet/arrow/schema.cc
Comment thread cpp/src/parquet/arrow/schema.cc Outdated
Comment thread cpp/src/parquet/arrow/schema.cc
Comment thread cpp/src/parquet/arrow/schema.cc Outdated

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

Mostly look good to me. Thanks for fixing this!

Comment thread cpp/src/parquet/arrow/schema.cc Outdated
Comment thread cpp/src/parquet/arrow/schema.cc Outdated
Comment thread cpp/src/parquet/arrow/schema.cc Outdated
Comment thread cpp/src/parquet/arrow/schema.cc Outdated
} else if (list_group.field_count() == 1) {
const auto& repeated_field = list_group.field(0);
if (repeated_field->is_repeated()) {
RETURN_NOT_OK(check_two_level_list_repeated(group));

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 need to validate that list_group has no logical type annotation?

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.

I think this is not in backward-compatibility rules.

Comment thread cpp/src/parquet/arrow/schema.cc
// optional binary value (STRING);
// }
// }
// }

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 want to add a case for the below which is still produced by parquet-java by default:

    // optional group my_list (LIST) {
    //   repeated group array (MAP) {
    //     repeated group key_value (MAP_KEY_VALUE) {
    //       required binary key (STRING);
    //       optional binary value (STRING);
    //     }
    //   }
    // }

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.

I think it's not in backward-compatibility rules too. We may add it into document first.

Comment thread cpp/src/parquet/arrow/arrow_schema_test.cc
@wgtmac

wgtmac commented Feb 10, 2026

Copy link
Copy Markdown
Member

Do you want to take a look? @pitrou @emkornfield @mapleFU

@wgtmac
wgtmac merged commit 0cf32b2 into apache:main Feb 21, 2026
50 of 51 checks passed
@wgtmac wgtmac removed the awaiting committer review Awaiting committer review label Feb 21, 2026
@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 0cf32b2.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 1 possible false positive for unstable benchmarks that are known to sometimes produce them.

@HuaHuaY
HuaHuaY deleted the fix_issue_49114 branch February 25, 2026 03:34
thisisnic pushed a commit to thisisnic/arrow that referenced this pull request Apr 6, 2026
…p nested two-level encoding list structure (apache#49125)

### Rationale for this change

Fix the failure when converting parquet schema with deep nested two-level encoding list structure to arrow schema.

### What changes are included in this PR?

Modified the `ListToSchemaField` and `MapToSchemaField` methods.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

It allows some legal schemas that were once considered illegal.
* GitHub Issue: apache#49114

Authored-by: Zehua Zou <zehuazou2000@gmail.com>
Signed-off-by: Gang Wu <ustcwg@gmail.com>
Mottl pushed a commit to Mottl/arrow that referenced this pull request May 26, 2026
…p nested two-level encoding list structure (apache#49125)

### Rationale for this change

Fix the failure when converting parquet schema with deep nested two-level encoding list structure to arrow schema.

### What changes are included in this PR?

Modified the `ListToSchemaField` and `MapToSchemaField` methods.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

It allows some legal schemas that were once considered illegal.
* GitHub Issue: apache#49114

Authored-by: Zehua Zou <zehuazou2000@gmail.com>
Signed-off-by: Gang Wu <ustcwg@gmail.com>
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.

3 participants