### Question:
HiveWriterFactory { public static String computeBucketedFileName(Optional<String> queryId, int bucket) { String paddedBucket = Strings.padStart(Integer.toString(bucket), BUCKET_NUMBER_PADDING, '0'); if (queryId.isPresent()) { return format("0%s_0_%s", paddedBucket, queryId.get()); } return format("0%s_0", paddedBucket); } HiveWriterFactory(
            Set<HiveFileWriterFactory> fileWriterFactories,
            String schemaName,
            String tableName,
            boolean isCreateTable,
            boolean isTransactional,
            List<HiveColumnHandle> inputColumns,
            HiveStorageFormat tableStorageFormat,
            HiveStorageFormat partitionStorageFormat,
            Map<String, String> additionalTableParameters,
            OptionalInt bucketCount,
            List<SortingColumn> sortedBy,
            LocationHandle locationHandle,
            LocationService locationService,
            String queryId,
            HivePageSinkMetadataProvider pageSinkMetadataProvider,
            TypeManager typeManager,
            HdfsEnvironment hdfsEnvironment,
            PageSorter pageSorter,
            DataSize sortBufferSize,
            int maxOpenSortFiles,
            DateTimeZone parquetTimeZone,
            ConnectorSession session,
            NodeManager nodeManager,
            EventClient eventClient,
            HiveSessionProperties hiveSessionProperties,
            HiveWriterStats hiveWriterStats); HiveWriter createWriter(Page partitionColumns, int position, OptionalInt bucketNumber); static String computeBucketedFileName(Optional<String> queryId, int bucket); static String getFileExtension(JobConf conf, StorageFormat storageFormat);  }### Answer:
@Test public void testComputeBucketedFileName() { String name = computeBucketedFileName(Optional.of("20180102_030405_00641_x1y2z"), 1234); assertEquals(name, "001234_0_20180102_030405_00641_x1y2z"); assertEquals(getBucketIdFromFile(name), 1234); name = computeBucketedFileName(Optional.empty(), 1234); assertEquals(name, "001234_0"); assertEquals(getBucketIdFromFile(name), 1234); }