mustafaiman commented on a change in pull request #1701:
URL: https://github.com/apache/hive/pull/1701#discussion_r551753955



##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DynamicPartitionPruner.java
##########
@@ -100,37 +99,19 @@
 
   private int sourceInfoCount = 0;
 
-  private final Object endOfEvents = new Object();
-
   private int totalEventCount = 0;
 
-  public DynamicPartitionPruner(InputInitializerContext context, MapWork work, 
JobConf jobConf) throws
-      SerDeException {
-    this.context = context;
-    this.work = work;
-    this.jobConf = jobConf;
-    synchronized (this) {
-      initialize();
+  public void prune() throws SerDeException, IOException, 
InterruptedException, HiveException {
+    if (sourcesWaitingForEvents.isEmpty()) {
+      return;
     }
-  }
-
-  public void prune()
-      throws SerDeException, IOException,
-      InterruptedException, HiveException {
 
-    synchronized(sourcesWaitingForEvents) {

Review comment:
       Earlier it was neccessary because addEvent and DynamicPartitionPruner 
constructor were both modifying sourcesWaitingForEvents. Now, that set is only 
modified by DynamicPartitionPruner#prune (and the methods it calls). 
DynamicPartitionPruner#prune is called from HiveSplitGenerator's init method 
which is called only once by Tez 
(https://github.com/apache/tez/blob/849e1d7694cdfd2432d631830940bc95c6f26ead/tez-dag/src/main/java/org/apache/tez/dag/app/dag/RootInputInitializerManager.java#L281).
 Concurrent part is addEvent calls. addEvent calls just queue the events and 
not touch any mutable state. Therefore further synchronization is not necessary.




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to