[ 
https://issues.apache.org/jira/browse/HIVE-5018?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13756385#comment-13756385
 ] 

Thejas M Nair commented on HIVE-5018:
-------------------------------------

I haven't seen that checkstyle error you are seeing. I am not sure why it is 
happening. You can try canceling the patch , uploading a new file and making it 
patch available again to see if that happens on the pre-commit test environment 
as well

I went through some of the changes, I see that you are trying to save on object 
reference creation, such as the following - 

{code}
--- 
a/hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseStatsAggregator.java
+++ 
b/hbase-handler/src/java/org/apache/hadoop/hive/hbase/HBaseStatsAggregator.java
@@ -113,8 +113,9 @@ public boolean cleanUp(String rowID) {
       scan.setFilter(filter);
       ResultScanner scanner = htable.getScanner(scan);
       ArrayList<Delete> toDelete = new ArrayList<Delete>();
+      Delete delete;
       for (Result result : scanner) {
-        Delete delete = new Delete(result.getRow());
+        delete = new Delete(result.getRow());
         toDelete.add(delete);
       }
       htable.delete(toDelete);
{code}

While object creation has significant costs associated with it, I don't think 
this reference re-use will have any real impact. A reference is like a pointer 
in C/C++ , a memory location that stores the address of the object. JVM would 
be able to re-use this memory location in the existing implementation.  Can you 
give more details of the arithmetic program you ran to check the performance 
difference (including the code, total runtime, how many times you ran it)?

                
> Avoiding object instantiation in loops (issue 6)
> ------------------------------------------------
>
>                 Key: HIVE-5018
>                 URL: https://issues.apache.org/jira/browse/HIVE-5018
>             Project: Hive
>          Issue Type: Sub-task
>            Reporter: Benjamin Jakobus
>            Assignee: Benjamin Jakobus
>            Priority: Minor
>             Fix For: 0.12.0
>
>         Attachments: HIVE-5018.1.patch.txt
>
>
> Object instantiation inside loops is very expensive. Where possible, object 
> references should be created outside the loop so that they can be reused.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to