diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java index 9036d9e..f6a6855 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/Utilities.java @@ -3084,22 +3084,34 @@ public static double getHighestSamplePercentage (MapWork work) { } List finalPathsToAdd = new LinkedList<>(); - List> futures = new LinkedList<>(); + Map> futures = new LinkedHashMap<>(); for (final Path path : pathsToAdd) { - if (lDrvStat != null && lDrvStat.driverState == DriverState.INTERRUPT) + if (lDrvStat != null && lDrvStat.driverState == DriverState.INTERRUPT) { throw new IOException("Operation is Canceled. "); + } if (pool == null) { - finalPathsToAdd.add(new GetInputPathsCallable(path, job, work, hiveScratchDir, ctx, skipDummy).call()); + Path newPath = new GetInputPathsCallable(path, job, work, hiveScratchDir, ctx, skipDummy).call(); + if (!newPath.equals(path)) { + updatePathForMapWork(newPath, work, path); + } + finalPathsToAdd.add(newPath); } else { - futures.add(pool.submit(new GetInputPathsCallable(path, job, work, hiveScratchDir, ctx, skipDummy))); + GetInputPathsCallable callable = new GetInputPathsCallable(path, job, work, hiveScratchDir, ctx, skipDummy); + futures.put(callable, pool.submit(callable)); } } if (pool != null) { - for (Future future : futures) { - if (lDrvStat != null && lDrvStat.driverState == DriverState.INTERRUPT) + for (Map.Entry> future : futures.entrySet()) { + if (lDrvStat != null && lDrvStat.driverState == DriverState.INTERRUPT) { throw new IOException("Operation is Canceled. "); - finalPathsToAdd.add(future.get()); + } + + Path newPath = future.getValue().get(); + if (!newPath.equals(future.getKey().path)) { + updatePathForMapWork(newPath, work, future.getKey().path); + } + finalPathsToAdd.add(newPath); } } @@ -3190,16 +3202,17 @@ private static Path createDummyFileForEmptyPartition(Path path, JobConf job, Map if (LOG.isInfoEnabled()) { LOG.info("Changed input file " + strPath + " to empty file " + newPath + " (" + oneRow + ")"); } + return newPath; + } + private static void updatePathForMapWork(Path newPath, MapWork work, Path path) { // update the work - + PartitionDesc partDesc = work.getPathToPartitionInfo().get(path); work.addPathToAlias(newPath, work.getPathToAliases().get(path)); work.removePathToAlias(path); work.removePathToPartitionInfo(path); work.addPathToPartitionInfo(newPath, partDesc); - - return newPath; } @SuppressWarnings("rawtypes")