Source:
private ImmutableList<PartitionUpdate> computePartitionUpdatesForMissingBuckets( ConnectorSession session, HiveWritableTableHandle handle, Table table, List<PartitionUpdate> partitionUpdates, boolean isInsert) { ImmutableList.Builder<PartitionUpdate> partitionUpdatesForMissingBucketsBuilder = ImmutableList.builder(); HiveStorageFormat storageFormat = table.getPartitionColumns().isEmpty() ? handle.getTableStorageFormat() : handle.getPartitionStorageFormat(); if (table.getPartitionColumns().isEmpty() && partitionUpdates.isEmpty()) { int bucketCount = handle.getBucketProperty().get().getBucketCount(); LocationHandle locationHandle = handle.getLocationHandle(); List<String> fileNamesForMissingBuckets = computeFileNamesForMissingBuckets( session, table, storageFormat, locationHandle.getTargetPath(), handle.getFilePrefix(), bucketCount, ImmutableList.of()); partitionUpdatesForMissingBucketsBuilder.add(new PartitionUpdate( "", isInsert ? APPEND : NEW, locationHandle.getWritePath(), locationHandle.getTargetPath(), fileNamesForMissingBuckets, 0, 0, 0)); } for (PartitionUpdate partitionUpdate : partitionUpdates) { int bucketCount = handle.getBucketProperty().get().getBucketCount(); List<String> fileNamesForMissingBuckets = computeFileNamesForMissingBuckets( session, table, storageFormat, partitionUpdate.getTargetPath(), handle.getFilePrefix(), bucketCount, partitionUpdate.getFileNames()); partitionUpdatesForMissingBucketsBuilder.add(new PartitionUpdate( partitionUpdate.getName(), partitionUpdate.getUpdateMode(), partitionUpdate.getWritePath(), partitionUpdate.getTargetPath(), fileNamesForMissingBuckets, 0, 0, 0)); } return partitionUpdatesForMissingBucketsBuilder.build(); }

Target:
private ImmutableList<PartitionUpdate> computePartitionUpdatesForMissingBuckets( ConnectorSession session, HiveWritableTableHandle handle, Table table, List<PartitionUpdate> partitionUpdates, boolean isInsert) { ImmutableList.Builder<PartitionUpdate> partitionUpdatesForMissingBucketsBuilder = ImmutableList.builder(); HiveStorageFormat storageFormat = table.getPartitionColumns().isEmpty() ? handle.getTableStorageFormat() : handle.getPartitionStorageFormat(); if (table.getPartitionColumns().isEmpty() && partitionUpdates.isEmpty()) { int bucketCount = handle.getBucketProperty().get().getBucketCount(); LocationHandle locationHandle = handle.getLocationHandle(); List<String> fileNamesForMissingBuckets = computeFileNamesForMissingBuckets( session, table, storageFormat, locationHandle.getTargetPath(), handle.getFilePrefix(), bucketCount, ImmutableList.of()); partitionUpdatesForMissingBucketsBuilder.add(new PartitionUpdate( "", isInsert ? APPEND : NEW, locationHandle.getWritePath(), locationHandle.getTargetPath(), fileNamesForMissingBuckets.stream() .map(fileName -> new FileWriteInfo(fileName, fileName)) .collect(toImmutableList()), 0, 0, 0)); } for (PartitionUpdate partitionUpdate : partitionUpdates) { int bucketCount = handle.getBucketProperty().get().getBucketCount(); List<String> fileNamesForMissingBuckets = computeFileNamesForMissingBuckets( session, table, storageFormat, partitionUpdate.getTargetPath(), handle.getFilePrefix(), bucketCount, partitionUpdate.getFileWriteInfos()); partitionUpdatesForMissingBucketsBuilder.add(new PartitionUpdate( partitionUpdate.getName(), partitionUpdate.getUpdateMode(), partitionUpdate.getWritePath(), partitionUpdate.getTargetPath(), fileNamesForMissingBuckets.stream() .map(fileName -> new FileWriteInfo(fileName, fileName)) .collect(toImmutableList()), 0, 0, 0)); } return partitionUpdatesForMissingBucketsBuilder.build(); }