You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/08/04 05:57:00 UTC

[jira] [Work logged] (HIVE-23953) Use task counter information to compute keycount during hashtable loading

     [ https://issues.apache.org/jira/browse/HIVE-23953?focusedWorklogId=466033&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-466033 ]

ASF GitHub Bot logged work on HIVE-23953:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 04/Aug/20 05:56
            Start Date: 04/Aug/20 05:56
    Worklog Time Spent: 10m 
      Work Description: rbalamohan commented on a change in pull request #1340:
URL: https://github.com/apache/hive/pull/1340#discussion_r464815905



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastHashTableLoader.java
##########
@@ -125,13 +126,24 @@ public void load(MapJoinTableContainer[] mapJoinTables,
         KeyValueReader kvReader = (KeyValueReader) input.getReader();
 
         Long keyCountObj = parentKeyCounts.get(pos);
-        long keyCount = (keyCountObj == null) ? -1 : keyCountObj.longValue();
+        long estKeyCount = (keyCountObj == null) ? -1 : keyCountObj;
+
+        long inputRecords = -1;
+        try {
+          inputRecords = ((AbstractLogicalInput) input).getContext().getCounters().

Review comment:
       Can you add TODO or a followup ticket that would replace this string with actual TaskCounter enum from tez (in next subsequent tez release) ?

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastHashTableLoader.java
##########
@@ -125,13 +126,24 @@ public void load(MapJoinTableContainer[] mapJoinTables,
         KeyValueReader kvReader = (KeyValueReader) input.getReader();
 
         Long keyCountObj = parentKeyCounts.get(pos);
-        long keyCount = (keyCountObj == null) ? -1 : keyCountObj.longValue();
+        long estKeyCount = (keyCountObj == null) ? -1 : keyCountObj;
+
+        long inputRecords = -1;
+        try {
+          inputRecords = ((AbstractLogicalInput) input).getContext().getCounters().
+                  findCounter("org.apache.tez.common.counters.TaskCounter",
+                          "APPROXIMATE_INPUT_RECORDS").getValue();
+        } catch (Exception e) {
+          LOG.debug("Failed to get value for counter APPROXIMATE_INPUT_RECORDS", e);
+        }
+        long keyCount = Math.max(estKeyCount, inputRecords);
 
         VectorMapJoinFastTableContainer vectorMapJoinFastTableContainer =
                 new VectorMapJoinFastTableContainer(desc, hconf, keyCount);
 
-        LOG.info("Loading hash table for input: {} cacheKey: {} tableContainer: {} smallTablePos: {}", inputName,
-          cacheKey, vectorMapJoinFastTableContainer.getClass().getSimpleName(), pos);
+        LOG.info("Loading hash table for input: {} cacheKey: {} tableContainer: {} smallTablePos: {} " +

Review comment:
       Can you add "delta" (line 171) in the log as well, to have details on the hash table load time?




----------------------------------------------------------------
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:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 466033)
    Time Spent: 20m  (was: 10m)

> Use task counter information to compute keycount during hashtable loading
> -------------------------------------------------------------------------
>
>                 Key: HIVE-23953
>                 URL: https://issues.apache.org/jira/browse/HIVE-23953
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Rajesh Balamohan
>            Assignee: mahesh kumar behera
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> There are cases when compiler misestimates key count and this results in a number of hashtable resizes during runtime.
> [https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/mapjoin/fast/VectorMapJoinFastHashTableLoader.java#L128]
> In such cases, it would be good to get "approximate_input_records" (TEZ-4207) counter from upstream to compute the key count more accurately at runtime.
>  
>  * 
>  * 
> Options
> h4.  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)