pgaref commented on a change in pull request #2305:
URL: https://github.com/apache/hive/pull/2305#discussion_r638089211



##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastHashTableLoader.java
##########
@@ -73,6 +104,74 @@ public void init(ExecMapperContext context, MapredContext 
mrContext,
     this.htLoadCounter = 
tezContext.getTezProcessorContext().getCounters().findCounter(counterGroup, 
counterName);
   }
 
+  private void initHTLoadingService(long estKeyCount) {
+    this.numLoadThreads = HiveConf.getIntVar(hconf, 
HiveConf.ConfVars.HIVEMAPJOINPARALELHASHTABLETHREADS);
+    this.totalEntries = new LongAccumulator(Long::sum, 0L);
+    this.loadExecService = Executors.newFixedThreadPool(numLoadThreads,
+        new ThreadFactoryBuilder()
+            .setDaemon(true)
+            .setPriority(Thread.NORM_PRIORITY)
+            .setNameFormat("HT-Load-Thread-%d")
+            .build());
+    this.elementBatches = new HashTableElementBatch[numLoadThreads];
+    this.loadBatchQueues = new BlockingQueue[numLoadThreads];
+    for (int i = 0; i < numLoadThreads; ++i) {
+      elementBatches[i] = new HashTableElementBatch();
+      loadBatchQueues[i] = new LinkedBlockingQueue();
+    }
+  }
+
+  private void submitQueueDrainThreads(VectorMapJoinFastTableContainer 
vectorMapJoinFastTableContainer)
+      throws InterruptedException, IOException, SerDeException {
+    for (int partitionId = 0; partitionId < numLoadThreads; partitionId++) {
+      int finalPartitionId = partitionId;
+      this.loadExecService.submit(() -> {
+        try {
+          LOG.info("Partition id {} with Queue size {}", finalPartitionId, 
loadBatchQueues[finalPartitionId].size());
+          drainAndLoadForPartition(finalPartitionId, 
vectorMapJoinFastTableContainer);
+        } catch (IOException | InterruptedException | SerDeException | 
HiveException e) {
+          LOG.error("Failed to start HT Load threads! {}", e);
+          throw new RuntimeException(e.getMessage(), e);

Review comment:
       ack




-- 
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