AWS: Optimize Iceberg-to-Glue schema type conversion - #16738
Open
wombatu-kun wants to merge 1 commit into
Open
Conversation
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions. |
Contributor
Author
|
not stlae |
wombatu-kun
force-pushed
the
aws-glue-converter-perf
branch
from
August 2, 2026 07:51
fac4b04 to
7946d34
Compare
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
wombatu-kun
force-pushed
the
aws-glue-converter-perf
branch
from
August 11, 2026 03:48
7946d34 to
49afbb8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #16735, which replaced the per-node
String.formatrecursion inHiveSchemaUtil.convertToTypeStringwith a singleStringBuilder. This applies the same optimization to the analogous Glue path,IcebergToGlueConverter.toTypeString, which runs on every Glue create/update commit (viasetTableInputInformation->toColumns, which also re-converts every schema in the table's schema history).The previous code allocated at every level of the type tree: a
String.formatper node (format-template parse, varargs array, autoboxing of decimal precision/scale, locale lookup), aStream/Collector/StringJoinerper struct, and it re-copied each child type string into its parent (superlinear for deeply nested types). The rewrite threads a singleStringBuilderthrough the recursion and appends directly, so each character is written once. The produced type strings are byte-identical, andtoTypeString's signature and all call sites are unchanged.This is a performance and readability change only, with no behavior change: Glue's
defaultcase already rendered VARIANT and other types without error, so there is no correctness component here.Benchmark
A JMH benchmark over three schema shapes (avg time and
gc.alloc.rate.norm, JDK 21, 1 fork, 5+5 iterations,-prof gc). The benchmark is not included in this PR.WIDE_FLAT(200 primitive cols, control)DEEPLY_NESTED(~10-deep struct/list/map)WIDE_NESTED_MIX(100 mixed cols)WIDE_FLATis a control dominated by per-columnColumn/ImmutableMapbuilding that this change does not touch, so it stays roughly flat; the win grows with nesting depth and the number of nested columns. Allocation figures are deterministic; theWIDE_NESTED_MIXbaseline time had high run-to-run variance, so its allocation reduction is the reliable measure there. ExistingTestIcebergToGlueConvertercontinues to pass, pinning the byte-identical output.AI Disclosure