kasakrisz commented on a change in pull request #1324: URL: https://github.com/apache/hive/pull/1324#discussion_r463488319
########## File path: ql/src/java/org/apache/hadoop/hive/ql/optimizer/SharedWorkOptimizer.java ########## @@ -247,6 +249,18 @@ public ParseContext transform(ParseContext pctx) throws SemanticException { } } + if (LOG.isDebugEnabled()) { + LOG.debug("Before SharedWorkOptimizer #2:\n" + Operator.toString(pctx.getTopOps().values())); + } + + // Execute shared work optimization + new BaseSharedWorkOptimizer().sharedWorkOptimization( + pctx, optimizerCache, tableNameToOps, sortedTables, false); + + if (LOG.isDebugEnabled()) { + LOG.debug("After SharedWorkOptimizer #2:\n" + Operator.toString(pctx.getTopOps().values())); Review comment: fixed ########## File path: ql/src/java/org/apache/hadoop/hive/ql/optimizer/SharedWorkOptimizer.java ########## @@ -273,258 +287,332 @@ public ParseContext transform(ParseContext pctx) throws SemanticException { return pctx; } - private static boolean sharedWorkOptimization(ParseContext pctx, SharedWorkOptimizerCache optimizerCache, - ArrayListMultimap<String, TableScanOperator> tableNameToOps, List<Entry<String, Long>> sortedTables, - boolean removeSemijoin) throws SemanticException { - // Boolean to keep track of whether this method actually merged any TS operators - boolean mergedExecuted = false; - - Multimap<String, TableScanOperator> existingOps = ArrayListMultimap.create(); - Set<Operator<?>> removedOps = new HashSet<>(); - for (Entry<String, Long> tablePair : sortedTables) { - String tableName = tablePair.getKey(); - for (TableScanOperator discardableTsOp : tableNameToOps.get(tableName)) { - if (removedOps.contains(discardableTsOp)) { - LOG.debug("Skip {} as it has already been removed", discardableTsOp); - continue; - } - Collection<TableScanOperator> prevTsOps = existingOps.get(tableName); - for (TableScanOperator retainableTsOp : prevTsOps) { - if (removedOps.contains(retainableTsOp)) { - LOG.debug("Skip {} as it has already been removed", retainableTsOp); + private static class BaseSharedWorkOptimizer { Review comment: fixed ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org