Source:
<code>private Optional<InternalHiveSplit> createInternalHiveSplit( Path path, BlockLocation[] blockLocations, long start, long length, long fileSize, OptionalInt readBucketNumber, OptionalInt tableBucketNumber, boolean splittable, Optional<byte[]> extraFileInfo) { String pathString = path.toString(); if (!pathMatchesPredicate(pathDomain, pathString)) { return Optional.empty(); } <START> if (fileSize == 0 && blockLocations.length == 0) { <END> blockLocations = new BlockLocation[] {new BlockLocation()}; } ImmutableList.Builder<InternalHiveBlock> blockBuilder = ImmutableList.builder(); for (BlockLocation blockLocation : blockLocations) { long blockStart = Math.max(start, blockLocation.getOffset()); long blockEnd = Math.min(start + length, blockLocation.getOffset() + blockLocation.getLength()); if (blockStart > blockEnd) { continue; } if (blockStart == blockEnd && !(blockStart == start && blockEnd == start + length)) { continue; } List<HostAddress> addresses = getHostAddresses(blockLocation); if (!needsHostAddresses(nodeSelectionStrategy, addresses)) { addresses = ImmutableList.of(); } blockBuilder.add(new InternalHiveBlock(blockEnd, addresses)); } List<InternalHiveBlock> blocks = blockBuilder.build(); checkBlocks(blocks, start, length); if (!splittable) { List<HostAddress> addresses = blocks.get(0).getAddresses(); if (!needsHostAddresses(nodeSelectionStrategy, addresses)) { addresses = ImmutableList.of(); } blocks = ImmutableList.of(new InternalHiveBlock(start + length, addresses)); } URI relativePath = partitionInfo.getPath().relativize(path.toUri()); return Optional.of(new InternalHiveSplit( relativePath.toString(), start, start + length, length, blocks, readBucketNumber, tableBucketNumber, splittable, (nodeSelectionStrategy == HARD_AFFINITY && !allBlocksHaveRealAddress(blocks)) ? NO_PREFERENCE : nodeSelectionStrategy, s3SelectPushdownEnabled && S3SelectPushdown.isCompressionCodecSupported(inputFormat, path), partitionInfo, extraFileInfo)); }</code><technical_language>boolean forceLocalScheduling = nodeSelectionStrategy == HARD_AFFINITY</technical_language>

Target:
private Optional<InternalHiveSplit> createInternalHiveSplit( Path path, BlockLocation[] blockLocations, long start, long length, long fileSize, OptionalInt readBucketNumber, OptionalInt tableBucketNumber, boolean splittable, Optional<byte[]> extraFileInfo) { String pathString = path.toString(); if (!pathMatchesPredicate(pathDomain, pathString)) { return Optional.empty(); } boolean forceLocalScheduling = this.nodeSelectionStrategy == HARD_AFFINITY; if (fileSize == 0 && blockLocations.length == 0) { blockLocations = new BlockLocation[] {new BlockLocation()}; forceLocalScheduling = false; } ImmutableList.Builder<InternalHiveBlock> blockBuilder = ImmutableList.builder(); for (BlockLocation blockLocation : blockLocations) { long blockStart = Math.max(start, blockLocation.getOffset()); long blockEnd = Math.min(start + length, blockLocation.getOffset() + blockLocation.getLength()); if (blockStart > blockEnd) { continue; } if (blockStart == blockEnd && !(blockStart == start && blockEnd == start + length)) { continue; } List<HostAddress> addresses = getHostAddresses(blockLocation); if (!needsHostAddresses(forceLocalScheduling, addresses)) { addresses = ImmutableList.of(); } blockBuilder.add(new InternalHiveBlock(blockEnd, addresses)); } List<InternalHiveBlock> blocks = blockBuilder.build(); checkBlocks(blocks, start, length); if (!splittable) { List<HostAddress> addresses = blocks.get(0).getAddresses(); if (!needsHostAddresses(forceLocalScheduling, addresses)) { addresses = ImmutableList.of(); } blocks = ImmutableList.of(new InternalHiveBlock(start + length, addresses)); } URI relativePath = partitionInfo.getPath().relativize(path.toUri()); return Optional.of(new InternalHiveSplit( relativePath.toString(), start, start + length, length, blocks, readBucketNumber, tableBucketNumber, splittable, forceLocalScheduling && allBlocksHaveRealAddress(blocks) ? HARD_AFFINITY : nodeSelectionStrategy, s3SelectPushdownEnabled && S3SelectPushdown.isCompressionCodecSupported(inputFormat, path), partitionInfo, extraFileInfo)); }