Source:
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle layoutHandle) { HiveTableLayoutHandle hiveLayoutHandle = (HiveTableLayoutHandle) layoutHandle; List<ColumnHandle> partitionColumns = hiveLayoutHandle.getPartitionColumns(); List<HivePartition> partitions = hiveLayoutHandle.getPartitions().get(); TupleDomain<ColumnHandle> predicate; if (partitions.isEmpty()) { predicate = TupleDomain.none(); } else { ImmutableMap.Builder<ColumnHandle, Domain> predicateBuilder = ImmutableMap.builder(); hiveLayoutHandle.getEffectivePredicate().getDomains() .map(domains -> Maps.filterKeys(domains, not(Predicates.in(partitionColumns)))) .map(predicateBuilder::putAll); createPredicate(partitionColumns, partitions).getDomains() .map(predicateBuilder::putAll); predicate = withColumnDomains(predicateBuilder.build()); } Optional<DiscretePredicates> discretePredicates = Optional.empty(); if (!partitionColumns.isEmpty()) { Iterable<TupleDomain<ColumnHandle>> partitionDomains = Iterables.transform(partitions, (hivePartition) -> TupleDomain.fromFixedValues(hivePartition.getKeys())); discretePredicates = Optional.of(new DiscretePredicates(partitionColumns, partitionDomains)); } Optional<ConnectorTablePartitioning> tablePartitioning = Optional.empty(); if (isBucketExecutionEnabled(session) && hiveLayoutHandle.getBucketHandle().isPresent()) { tablePartitioning = hiveLayoutHandle.getBucketHandle().map(hiveBucketHandle -> new ConnectorTablePartitioning( new HivePartitioningHandle( hiveBucketHandle.getReadBucketCount(), hiveBucketHandle.getColumns().stream() .map(HiveColumnHandle::getHiveType) .collect(Collectors.toList()), OptionalInt.empty()), hiveBucketHandle.getColumns().stream() .map(ColumnHandle.class::cast) .collect(toList()))); } return new ConnectorTableLayout( hiveLayoutHandle, Optional.empty(), predicate, tablePartitioning, Optional.empty(), discretePredicates, ImmutableList.of()); }

Target:
public ConnectorTableLayout getTableLayout(ConnectorSession session, ConnectorTableLayoutHandle layoutHandle) { HiveTableLayoutHandle hiveLayoutHandle = (HiveTableLayoutHandle) layoutHandle; List<ColumnHandle> partitionColumns = hiveLayoutHandle.getPartitionColumns(); List<HivePartition> partitions = hiveLayoutHandle.getPartitions().get(); TupleDomain<ColumnHandle> predicate; if (partitions.isEmpty()) { predicate = TupleDomain.none(); } else { ImmutableMap.Builder<ColumnHandle, Domain> predicateBuilder = ImmutableMap.builder(); hiveLayoutHandle.getEffectivePredicate().getDomains() .map(domains -> filterKeys(domains, not(in(partitionColumns)))) .ifPresent(predicateBuilder::putAll); createPredicate(partitionColumns, partitions).getDomains() .ifPresent(predicateBuilder::putAll); predicate = withColumnDomains(predicateBuilder.build()); } Optional<DiscretePredicates> discretePredicates = Optional.empty(); if (!partitionColumns.isEmpty()) { Iterable<TupleDomain<ColumnHandle>> partitionDomains = Iterables.transform(partitions, (hivePartition) -> TupleDomain.fromFixedValues(hivePartition.getKeys())); discretePredicates = Optional.of(new DiscretePredicates(partitionColumns, partitionDomains)); } Optional<ConnectorTablePartitioning> tablePartitioning = Optional.empty(); if (isBucketExecutionEnabled(session) && hiveLayoutHandle.getBucketHandle().isPresent()) { tablePartitioning = hiveLayoutHandle.getBucketHandle().map(hiveBucketHandle -> new ConnectorTablePartitioning( new HivePartitioningHandle( hiveBucketHandle.getReadBucketCount(), hiveBucketHandle.getColumns().stream() .map(HiveColumnHandle::getHiveType) .collect(Collectors.toList()), OptionalInt.empty()), hiveBucketHandle.getColumns().stream() .map(ColumnHandle.class::cast) .collect(toList()))); } return new ConnectorTableLayout( hiveLayoutHandle, Optional.empty(), predicate, tablePartitioning, Optional.empty(), discretePredicates, ImmutableList.of()); }