use of org.apache.flink.connector.file.table.PartitionFetcher.Context.ComparablePartitionValue in project flink by apache.
the class HiveContinuousPartitionFetcher method fetchPartitions.
@Override
@SuppressWarnings("unchecked")
public List<Tuple2<Partition, T>> fetchPartitions(Context<Partition, T> context, T previousOffset) throws Exception {
List<Tuple2<Partition, T>> partitions = new ArrayList<>();
List<ComparablePartitionValue> partitionValueList = context.getComparablePartitionValueList();
for (ComparablePartitionValue<List<String>, T> partitionValue : partitionValueList) {
T partitionOffset = partitionValue.getComparator();
if (partitionOffset.compareTo(previousOffset) >= 0) {
Partition partition = context.getPartition(partitionValue.getPartitionValue()).orElseThrow(() -> new IllegalArgumentException(String.format("Fetch partition fail for hive table %s.", context.getTablePath())));
partitions.add(new Tuple2<>(partition, partitionValue.getComparator()));
}
}
return partitions;
}
use of org.apache.flink.connector.file.table.PartitionFetcher.Context.ComparablePartitionValue in project flink by splunk.
the class HiveContinuousPartitionFetcher method fetchPartitions.
@Override
@SuppressWarnings("unchecked")
public List<Tuple2<Partition, T>> fetchPartitions(Context<Partition, T> context, T previousOffset) throws Exception {
List<Tuple2<Partition, T>> partitions = new ArrayList<>();
List<ComparablePartitionValue> partitionValueList = context.getComparablePartitionValueList();
for (ComparablePartitionValue<List<String>, T> partitionValue : partitionValueList) {
T partitionOffset = partitionValue.getComparator();
if (partitionOffset.compareTo(previousOffset) >= 0) {
Partition partition = context.getPartition(partitionValue.getPartitionValue()).orElseThrow(() -> new IllegalArgumentException(String.format("Fetch partition fail for hive table %s.", context.getTablePath())));
partitions.add(new Tuple2<>(partition, partitionValue.getComparator()));
}
}
return partitions;
}
use of org.apache.flink.connector.file.table.PartitionFetcher.Context.ComparablePartitionValue in project flink-mirror by flink-ci.
the class HiveContinuousPartitionFetcher method fetchPartitions.
@Override
@SuppressWarnings("unchecked")
public List<Tuple2<Partition, T>> fetchPartitions(Context<Partition, T> context, T previousOffset) throws Exception {
List<Tuple2<Partition, T>> partitions = new ArrayList<>();
List<ComparablePartitionValue> partitionValueList = context.getComparablePartitionValueList();
for (ComparablePartitionValue<List<String>, T> partitionValue : partitionValueList) {
T partitionOffset = partitionValue.getComparator();
if (partitionOffset.compareTo(previousOffset) >= 0) {
Partition partition = context.getPartition(partitionValue.getPartitionValue()).orElseThrow(() -> new IllegalArgumentException(String.format("Fetch partition fail for hive table %s.", context.getTablePath())));
partitions.add(new Tuple2<>(partition, partitionValue.getComparator()));
}
}
return partitions;
}
Aggregations