Skip to content

Commit

Permalink
Add Hive schemas into InputFormat#getSplits
Browse files Browse the repository at this point in the history
  • Loading branch information
rumeshkrish authored and electrum committed Mar 25, 2021
1 parent fcd7f32 commit f1ca46d
Showing 1 changed file with 3 additions and 0 deletions.
Expand Up @@ -90,6 +90,7 @@
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.collect.ImmutableSet.toImmutableSet;
import static com.google.common.collect.Iterables.getOnlyElement;
import static com.google.common.collect.Maps.fromProperties;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static io.airlift.concurrent.MoreFutures.addExceptionCallback;
import static io.airlift.concurrent.MoreFutures.toListenableFuture;
Expand Down Expand Up @@ -472,6 +473,8 @@ private ListenableFuture<?> loadPartition(HivePartitionMetadata partition)

JobConf jobConf = toJobConf(configuration);
FileInputFormat.setInputPaths(jobConf, path);
// Pass SerDes and Table parameters into input format configuration
fromProperties(schema).forEach(jobConf::set);
InputSplit[] splits = hdfsEnvironment.doAs(hdfsContext.getIdentity().getUser(), () -> inputFormat.getSplits(jobConf, 0));

return addSplitsToSource(splits, splitFactory);
Expand Down

0 comments on commit f1ca46d

Please sign in to comment.