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.


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

To unsubscribe, e-mail: [email protected]

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