Skip to content

Core: Handle UnknownType in SingleValueParser - #17672

Open
Abhishek-Gawande wants to merge 1 commit into
apache:mainfrom
Abhishek-Gawande:fix-issue-17324
Open

Core: Handle UnknownType in SingleValueParser#17672
Abhishek-Gawande wants to merge 1 commit into
apache:mainfrom
Abhishek-Gawande:fix-issue-17324

Conversation

@Abhishek-Gawande

Copy link
Copy Markdown

Fixes #17324

What changes were proposed in this pull request?

This PR adds support for TypeID.UNKNOWN in SingleValueParser, fixing an issue where the REST catalog's /plan endpoint can fail with a truncated HTTP 200 OK response.

Why are the changes needed?

When a partition field references a column that is subsequently dropped from the table schema, PartitionSpec.resultType() falls back to Types.UnknownType.get().

However, when ContentFileParser serializes the data file's partition values, SingleValueParser.toJson() does not handle UNKNOWN and throws an UnsupportedOperationException.

This can occur while the JSON response is being streamed, resulting in a partially written response when serialization fails.

How was this patch tested?

  • Added TestSingleValueParser.unknownTypeRoundTrip to verify that UnknownType correctly handles nulls, integer values serialized as strings, and string values.
  • Added TestContentFileParser.partitionSerializationWithDroppedSourceColumn to reproduce the issue by simulating a dropped source column, re-binding the historical partition spec, and verifying that the partition data can be serialized and deserialized successfully.
  • Verified locally with ./gradlew :iceberg-core:test.
  • Ran ./gradlew spotlessApply.

@github-actions github-actions Bot added the core label Aug 15, 2026

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

Thanks @Abhishek-Gawande for the PR. I have a spec related question.

generator.writeEndObject();
break;
case UNKNOWN:
generator.writeString(String.valueOf(defaultValue));

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 thought the spec treats unknown as null. Should this be generator.writeNull()?

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FixtureCatalog][Dev][Scan Planning] Catalog server returns invalid (cut off) JSON response

2 participants