Search in sources :

Example 6 with HoodieRealtimeBootstrapBaseFileSplit

use of org.apache.hudi.hadoop.realtime.HoodieRealtimeBootstrapBaseFileSplit in project presto by prestodb.

the class HudiRealtimeBootstrapBaseFileSplitConverter method extractCustomSplitInfo.

@Override
public Optional<Map<String, String>> extractCustomSplitInfo(FileSplit split) {
    if (split instanceof HoodieRealtimeBootstrapBaseFileSplit) {
        ImmutableMap.Builder<String, String> customSplitInfo = ImmutableMap.builder();
        HoodieRealtimeBootstrapBaseFileSplit hudiSplit = (HoodieRealtimeBootstrapBaseFileSplit) split;
        customSplitInfo.put(CUSTOM_FILE_SPLIT_CLASS_KEY, HoodieRealtimeBootstrapBaseFileSplit.class.getName());
        customSplitInfo.put(BASE_PATH_KEY, hudiSplit.getBasePath());
        customSplitInfo.put(MAX_COMMIT_TIME_KEY, hudiSplit.getMaxCommitTime());
        customSplitInfo.put(DELTA_FILE_PATHS_KEY, String.join(",", hudiSplit.getDeltaLogPaths()));
        customSplitInfo.put(BOOTSTRAP_FILE_SPLIT_PATH, hudiSplit.getBootstrapFileSplit().getPath().toString());
        customSplitInfo.put(BOOTSTRAP_FILE_SPLIT_START, String.valueOf(hudiSplit.getBootstrapFileSplit().getStart()));
        customSplitInfo.put(BOOTSTRAP_FILE_SPLIT_LEN, String.valueOf(hudiSplit.getBootstrapFileSplit().getLength()));
        return Optional.of(customSplitInfo.build());
    }
    return Optional.empty();
}
Also used : ImmutableMap(com.google.common.collect.ImmutableMap) HoodieRealtimeBootstrapBaseFileSplit(org.apache.hudi.hadoop.realtime.HoodieRealtimeBootstrapBaseFileSplit)

Aggregations

HoodieRealtimeBootstrapBaseFileSplit (org.apache.hudi.hadoop.realtime.HoodieRealtimeBootstrapBaseFileSplit)6 ImmutableMap (com.google.common.collect.ImmutableMap)4 IOException (java.io.IOException)4 Arrays (java.util.Arrays)4 List (java.util.List)4 Map (java.util.Map)4 Collectors (java.util.stream.Collectors)4 Path (org.apache.hadoop.fs.Path)4 FileSplit (org.apache.hadoop.mapred.FileSplit)4 HoodieLogFile (org.apache.hudi.common.model.HoodieLogFile)4 Option (org.apache.hudi.common.util.Option)4 CUSTOM_FILE_SPLIT_CLASS_KEY (com.facebook.presto.hive.HiveUtil.CUSTOM_FILE_SPLIT_CLASS_KEY)2 Strings.isNullOrEmpty (com.google.common.base.Strings.isNullOrEmpty)2 ImmutableList (com.google.common.collect.ImmutableList)2 Long.parseLong (java.lang.Long.parseLong)2 Collections (java.util.Collections)2 Objects.requireNonNull (java.util.Objects.requireNonNull)2 Optional (java.util.Optional)2 BootstrapBaseFileSplit (org.apache.hudi.hadoop.BootstrapBaseFileSplit)2 HoodieRealtimeFileSplit (org.apache.hudi.hadoop.realtime.HoodieRealtimeFileSplit)2