Source:
public ConnectorTableHandle createTemporaryTable(ConnectorSession session, List<ColumnMetadata> columns, Optional<ConnectorPartitioningMetadata> partitioningMetadata) { String schemaName = getTemporaryTableSchema(session); String tableName = "__presto_temporary_table_" + randomUUID().toString().replaceAll("-", "_"); HiveStorageFormat storageFormat = getTemporaryTableStorageFormat(session); Optional<HiveBucketProperty> bucketProperty = partitioningMetadata.map(partitioning -> { Set<String> allColumns = columns.stream() .map(ColumnMetadata::getName) .collect(toImmutableSet()); if (!allColumns.containsAll(partitioning.getPartitionColumns())) { throw new PrestoException(INVALID_TABLE_PROPERTY, format( "Bucketing columns %s not present in schema", Sets.difference(ImmutableSet.copyOf(partitioning.getPartitionColumns()), allColumns))); } HivePartitioningHandle partitioningHandle = (HivePartitioningHandle) partitioning.getPartitioningHandle(); return new HiveBucketProperty(partitioning.getPartitionColumns(), partitioningHandle.getBucketCount(), ImmutableList.of()); }); List<HiveColumnHandle> columnHandles = getColumnHandles(columns, ImmutableSet.of(), typeTranslator); storageFormat.validateColumns(columnHandles); LocationHandle locationHandle = locationService.forNewTable(metastore, session, schemaName, tableName); Path targetPath = locationService.getQueryWriteInfo(locationHandle).getTargetPath(); Table table = buildTableObject( session.getQueryId(), schemaName, tableName, session.getUser(), columnHandles, storageFormat, ImmutableList.of(), bucketProperty, ImmutableMap.of(), targetPath, TEMPORARY_TABLE, prestoVersion); metastore.createTable( session, table, buildInitialPrivilegeSet(table.getOwner()), Optional.empty(), false, new PartitionStatistics(createEmptyStatistics(), ImmutableMap.of())); return new HiveTableHandle(schemaName, tableName); }

Target:
public ConnectorTableHandle createTemporaryTable(ConnectorSession session, List<ColumnMetadata> columns, Optional<ConnectorPartitioningMetadata> partitioningMetadata) { String schemaName = getTemporaryTableSchema(session); String tableName = PRESTO_TEMPORARY_TABLE_NAME_PREFIX + randomUUID().toString().replaceAll("-", "_"); HiveStorageFormat storageFormat = getTemporaryTableStorageFormat(session); Optional<HiveBucketProperty> bucketProperty = partitioningMetadata.map(partitioning -> { Set<String> allColumns = columns.stream() .map(ColumnMetadata::getName) .collect(toImmutableSet()); if (!allColumns.containsAll(partitioning.getPartitionColumns())) { throw new PrestoException(INVALID_TABLE_PROPERTY, format( "Bucketing columns %s not present in schema", Sets.difference(ImmutableSet.copyOf(partitioning.getPartitionColumns()), allColumns))); } HivePartitioningHandle partitioningHandle = (HivePartitioningHandle) partitioning.getPartitioningHandle(); return new HiveBucketProperty(partitioning.getPartitionColumns(), partitioningHandle.getBucketCount(), ImmutableList.of()); }); List<HiveColumnHandle> columnHandles = getColumnHandles(columns, ImmutableSet.of(), typeTranslator); storageFormat.validateColumns(columnHandles); Table table = Table.builder() .setDatabaseName(schemaName) .setTableName(tableName) .setOwner(session.getUser()) .setTableType(TEMPORARY_TABLE) .setDataColumns(columnHandles.stream() .map(handle -> new Column(handle.getName(), handle.getHiveType(), handle.getComment())) .collect(toImmutableList())) .withStorage(storage -> storage .setStorageFormat(fromHiveStorageFormat(storageFormat)) .setBucketProperty(bucketProperty) .setLocation("")) .build(); metastore.createTable( session, table, buildInitialPrivilegeSet(table.getOwner()), Optional.empty(), false, new PartitionStatistics(createEmptyStatistics(), ImmutableMap.of())); return new HiveTableHandle(schemaName, tableName); }