Skip to content

fix: support nullable map key schemas and reject null key data - #176

Merged
SteNicholas merged 3 commits into
apache:mainfrom
lxy-9602:support-nullalbe-key-map
Aug 4, 2026
Merged

fix: support nullable map key schemas and reject null key data#176
SteNicholas merged 3 commits into
apache:mainfrom
lxy-9602:support-nullalbe-key-map

Conversation

@lxy-9602

@lxy-9602 lxy-9602 commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Purpose

No Linked issue.

This PR restores nullable MAP-key schema compatibility that was removed by alibaba/paimon-cpp#226.

The changes:

  • Accept nullable MAP key declarations when parsing existing Paimon schemas.
  • Normalize parsed MAP key fields to non-nullable Arrow fields because Apache Arrow does not support nullable MAP keys.
  • Remove the general schema validation requiring MAP keys to be explicitly declared as NOT NULL.
  • Continue rejecting nullable MAP keys for the shared-shredding storage layout.
  • Validate Arrow arrays at the ORC and Parquet format-reader boundaries so data containing an actual null MAP key returns Status::Invalid instead of triggering an Arrow abort.
  • Restore nullable MAP key declarations in existing test schemas.

Tests

Added or updated coverage for:

  • Parsing a nullable MAP key declaration and normalizing it for Arrow.
  • Creating table schemas containing nullable MAP key declarations.
  • Rejecting nullable MAP keys when shared-shredding is enabled.
  • Reading the nullable-MAP-key ORC fixture with read.batch.size=1:
    • The first two rows are read and verified successfully.
    • The third row returns Map array keys array should have no nulls.

API and Format

Schema compatibility is relaxed so existing schemas may declare nullable MAP keys. An error is returned only when the physical data actually contains a null MAP key. Shared-shredding continues to require non-nullable MAP keys.

Documentation

Updated the data type and schema documentation to describe nullable MAP key compatibility and read-time validation behavior.

Generative AI tooling

Generated-by: OpenAI Codex (GPT-5)

@duanyyyyyyy

Copy link
Copy Markdown

LGTM

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

+1

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

LGTM.

@SteNicholas
SteNicholas merged commit 81608c7 into apache:main Aug 4, 2026
9 checks passed
SteNicholas pushed a commit that referenced this pull request Aug 5, 2026
* fix: support nullable map key schemas and reject null key data

* add validate for avro
SteNicholas pushed a commit that referenced this pull request Aug 5, 2026
* fix: support nullable map key schemas and reject null key data

* add validate for avro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants