io.prestosql.plugin.hive.HivePartitionResult Maven / Gradle / Ivy
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.prestosql.plugin.hive;
import io.prestosql.plugin.hive.util.HiveBucketing.HiveBucketFilter;
import io.prestosql.spi.connector.ColumnHandle;
import io.prestosql.spi.predicate.TupleDomain;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
import static java.util.Objects.requireNonNull;
/**
* Result of fetching Partitions in the HivePartitionManager interface.
*
* Results are comprised of two parts:
* 1) The actual partitions
* 2) The TupleDomain that represents the values that the connector was not able to pre-evaluate
* when generating the partitions and will need to be double-checked by the final execution plan.
*/
public class HivePartitionResult
{
private final List partitionColumns;
private final Iterable partitions;
private final TupleDomain compactEffectivePredicate;
private final TupleDomain unenforcedConstraint;
private final TupleDomain enforcedConstraint;
private final Optional bucketHandle;
private final Optional bucketFilter;
public HivePartitionResult(
List partitionColumns,
Iterable partitions,
TupleDomain compactEffectivePredicate,
TupleDomain unenforcedConstraint,
TupleDomain enforcedConstraint,
Optional bucketHandle,
Optional bucketFilter)
{
this.partitionColumns = requireNonNull(partitionColumns, "partitionColumns is null");
this.partitions = requireNonNull(partitions, "partitions is null");
this.compactEffectivePredicate = requireNonNull(compactEffectivePredicate, "compactEffectivePredicate is null");
this.unenforcedConstraint = requireNonNull(unenforcedConstraint, "unenforcedConstraint is null");
this.enforcedConstraint = requireNonNull(enforcedConstraint, "enforcedConstraint is null");
this.bucketHandle = requireNonNull(bucketHandle, "bucketHandle is null");
this.bucketFilter = requireNonNull(bucketFilter, "bucketFilter is null");
}
public List getPartitionColumns()
{
return partitionColumns;
}
public Iterator getPartitions()
{
return partitions.iterator();
}
public TupleDomain getCompactEffectivePredicate()
{
return compactEffectivePredicate;
}
public TupleDomain getUnenforcedConstraint()
{
return unenforcedConstraint;
}
public TupleDomain getEnforcedConstraint()
{
return enforcedConstraint;
}
public Optional getBucketHandle()
{
return bucketHandle;
}
public Optional getBucketFilter()
{
return bucketFilter;
}
}