HIVE-29798: NumberFormatException while reading a table having UNION subdirs after ACID conversion - #6675
Open
abstractdog wants to merge 3 commits into
Open
HIVE-29798: NumberFormatException while reading a table having UNION subdirs after ACID conversion#6675abstractdog wants to merge 3 commits into
abstractdog wants to merge 3 commits into
Conversation
abstractdog
force-pushed
the
HIVE-29798
branch
from
August 19, 2026 09:39
15c6d6c to
650eec7
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes UNION ALL directory/file layouts so non-ACID tables can be converted to ACID and read successfully.
Changes:
- Skip non-ACID parent directories in the vectorized ACID reader.
- Rename flattened union files to the ACID-compatible
000000_0_copy_Nformat. - Add conversion regression tests and update related expectations.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ql/src/test/org/apache/hadoop/hive/ql/metadata/TestUnionAllToAcidConversion.java | Updated as part of this pull request. |
| ql/src/test/org/apache/hadoop/hive/ql/metadata/TestInsertCopySuffixOnFakeS3.java | Updated as part of this pull request. |
| ql/src/test/org/apache/hadoop/hive/ql/exec/TestMoveTask.java | Updated as part of this pull request. |
| ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java | Updated as part of this pull request. |
| ql/src/java/org/apache/hadoop/hive/ql/exec/MoveTask.java | Updated as part of this pull request. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+159
to
+160
| fs.rename(path, | ||
| new Path(parentOfParent + "/" + path.getName() + Utilities.COPY_KEYWORD + parentNameSuffix)); |
Contributor
Author
There was a problem hiding this comment.
very good catch, I had to redesign the logic used in movetask, addressed in: 2057a99
abstractdog
force-pushed
the
HIVE-29798
branch
from
September 3, 2026 14:31
650eec7 to
100134a
Compare
abstractdog
force-pushed
the
HIVE-29798
branch
from
September 3, 2026 14:34
100134a to
2057a99
Compare
abstractdog
force-pushed
the
HIVE-29798
branch
from
September 4, 2026 09:59
2057a99 to
2048392
Compare
abstractdog
force-pushed
the
HIVE-29798
branch
from
September 4, 2026 10:08
2048392 to
94ba572
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.



What changes were proposed in this pull request?
Fix two layout issues that prevent a non-ACID table loaded via
INSERT ... UNION ALLfrom being read after ACID conversion.1. Reader side —
VectorizedOrcAcidRowBatchReader.java. When walking split parents looking for abase_*/delta_*/delete_delta_*ancestor, the "else" branch fed every non-base_*name toAcidUtils.ParsedDeltaLight.parse, which substrings pastdelta_and callsLong.parseLong. On aHIVE_UNION_SUBDIR_15/parent this throwsNumberFormatException: For input string: "NION". Fixed by guarding withstartsWith(DELTA_PREFIX) || startsWith(DELETE_DELTA_PREFIX)— mirroring the sibling non-vectorizedOrcRawRecordMerger.TransactionMetaData#findWriteIDForSynthetcRowIDs.2. Writer side —
MoveTask.flattenUnionSubdirectories. Whenhive.tez.union.flatten.subdirectories=true, MoveTask renamed:That name has three numeric parts, so it matches neither
ORIGINAL_PATTERN([0-9]+_[0-9]+) norORIGINAL_PATTERN_COPY, and the ACID conversion validator rejects it with"Unexpected data file name format".The fix folds the subdir index into the attempt-id portion of the writer name (arithmetic, not textual concatenation), keeping the flattened name in the plain writer-name namespace and out of the
_copy_namespace:Files touched:
ql/src/java/org/apache/hadoop/hive/ql/io/orc/VectorizedOrcAcidRowBatchReader.java— add theisBase / isDeltaguard aroundParsedDeltaLight.parse.ql/src/java/org/apache/hadoop/hive/ql/exec/MoveTask.java— flatten rename target changed from<N>_000000_0to000000_0_copy_<N>(usesUtilities.COPY_KEYWORD).Why are the changes needed?
Reading a table after converting it to ACID currently crashes if the pre-conversion data was written by a UNION-ALL — regardless of the flatten setting:
HIVE_UNION_SUBDIR_<N>/000000_0survives the conversion (metadata-only flip;TestTxnNoBuckets.testToAcidConversionMultiBucketpins this contract), but the reader crashes on the subdir name.TransactionalValidationListener.validateTableStructureForPathbecause<N>_000000_0doesn't match either allowed original-file pattern.Both ACID DDL paths —
ALTER TABLE ... CONVERT TO ACIDand the historicalALTER TABLE ... SET TBLPROPERTIES ('transactional'='true')(emitted byUpgradeTool) — are affected.Does this PR introduce any user-facing change?
Yes — a bug fix. Users can now convert non-ACID tables loaded via
INSERT ... UNION ALLto full ACID and read them, in both flatten modes. On-disk file-name change (flatten=on only): flattened union outputs are now written as000000_0_copy_<N>instead of<N>_000000_0. No API or DDL syntax changes.How was this patch tested?
New JUnit 5 test class
ql/src/test/org/apache/hadoop/hive/ql/metadata/TestUnionAllToAcidConversion— 8 tests covering{unpartitioned, partitioned} × {CONVERT TO ACID, SET TBLPROPERTIES('transactional'='true')} × {flatten OFF, flatten ON}. Each test asserts the exact on-disk layout before and after conversion, then assertsSELECT COUNT(*)returns 3.Asserted file layouts:
/<tbl>[/p=x]/HIVE_UNION_SUBDIR_{1,2,3}/000000_0— preserved through conversion./<tbl>[/p=x]/000000_0_copy_{1,2,3}— preserved through conversion (previously<N>_000000_0, which failed conversion).Regression check: