This is an automated email from the ASF dual-hosted git repository. dbecker pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/impala.git
commit bff3561573cfad3a08afc93d7442a748b8d5d4fd Author: Zoltan Borok-Nagy <[email protected]> AuthorDate: Tue Jul 1 13:37:42 2025 +0200 IMPALA-14194: Fix empty file handling with recent Ozone versions TestExplainEmptyPartition.test_non_empty_partition_0_rows can fail in Ozone builds, as for empty files Ozone started to return NULL as block locations, instead of an empty array of block locations. Testing * tested in Ozone build Change-Id: I067d66c8f90e235e871f16ac3f7faf190ffa13eb Reviewed-on: http://gerrit.cloudera.org:8080/23108 Reviewed-by: Csaba Ringhofer <[email protected]> Tested-by: Zoltan Borok-Nagy <[email protected]> --- .../org/apache/impala/catalog/FileDescriptor.java | 30 +++++++++++++--------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/fe/src/main/java/org/apache/impala/catalog/FileDescriptor.java b/fe/src/main/java/org/apache/impala/catalog/FileDescriptor.java index aa611585f..63a8db098 100644 --- a/fe/src/main/java/org/apache/impala/catalog/FileDescriptor.java +++ b/fe/src/main/java/org/apache/impala/catalog/FileDescriptor.java @@ -131,18 +131,24 @@ public class FileDescriptor implements Comparable<FileDescriptor> { Reference<Long> numUnknownDiskIds, String absPath) throws IOException { FlatBufferBuilder fbb = new FlatBufferBuilder(1); - int[] fbFileBlockOffsets = new int[blockLocations.length]; - int blockIdx = 0; - for (BlockLocation loc : blockLocations) { - if (isEc) { - fbFileBlockOffsets[blockIdx++] = FileBlock.createFbFileBlock( - fbb, - loc.getOffset(), - loc.getLength(), - (short) hostIndex.getOrAddIndex(REMOTE_NETWORK_ADDRESS)); - } else { - fbFileBlockOffsets[blockIdx++] = - FileBlock.createFbFileBlock(fbb, loc, hostIndex, numUnknownDiskIds); + int[] fbFileBlockOffsets; + if (blockLocations == null) { + Preconditions.checkState(fileStatus.getLen() == 0); + fbFileBlockOffsets = new int[0]; + } else { + fbFileBlockOffsets = new int[blockLocations.length]; + int blockIdx = 0; + for (BlockLocation loc : blockLocations) { + if (isEc) { + fbFileBlockOffsets[blockIdx++] = FileBlock.createFbFileBlock( + fbb, + loc.getOffset(), + loc.getLength(), + (short) hostIndex.getOrAddIndex(REMOTE_NETWORK_ADDRESS)); + } else { + fbFileBlockOffsets[blockIdx++] = + FileBlock.createFbFileBlock(fbb, loc, hostIndex, numUnknownDiskIds); + } } } return new FileDescriptor(createFbFileDesc(fbb, fileStatus, relPath,
