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

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

                Author: ASF GitHub Bot
            Created on: 27/Jul/22 12:27
            Start Date: 27/Jul/22 12:27
    Worklog Time Spent: 10m 
      Work Description: pudidic commented on PR #3441:
URL: https://github.com/apache/hive/pull/3441#issuecomment-1196663673

   @cmunkey
   
   I tried to minimize indexed accessors of Stack, exposing push/pop/peek only. 
Because there already are several use cases of Stack#get(int), I implemented 
ArrayStack#get(int) also.
   
   However, LevelOrderWalker has a unique usage of Stack. LevelOrderWalker 
calls stack.add(0, element) and stack.remove(0) to add/remove elements at the 
start of the stack. They are inverse of stack.pop/push, which add/remove at the 
end. The rest of part still calls Stack.pop/push, as not inverse. I tried to 
replace stack.add(0, element) with stack.push and stack.remove(0) with 
stack.pop, but it behaved very differently. The inverse push/pop is not I 
wanted to expose. So I implemented a subclass in LevelOrderWalker to isolate 
its use from others. Maybe I need to document to make its purpose clear.
   
   I'll replace == with equals in indexOf(). Thank you for advice.




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

    Worklog Id:     (was: 795634)
    Time Spent: 1.5h  (was: 1h 20m)

> stop using java.util.Stack
> --------------------------
>
>                 Key: HIVE-1626
>                 URL: https://issues.apache.org/jira/browse/HIVE-1626
>             Project: Hive
>          Issue Type: Improvement
>          Components: Query Processor
>    Affects Versions: 0.7.0
>            Reporter: John Sichi
>            Assignee: Teddy Choi
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: HIVE-1626.2.patch, HIVE-1626.2.patch, HIVE-1626.3.patch, 
> HIVE-1626.3.patch, HIVE-1626.3.patch
>
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> We currently use Stack as part of the generic node walking library.  Stack 
> should not be used for this since its inheritance from Vector incurs 
> superfluous synchronization overhead.
> Most projects end up adding an ArrayStack implementation and using that 
> instead.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to