You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "David Mollitor (Jira)" <ji...@apache.org> on 2019/12/11 19:45:00 UTC
[jira] [Comment Edited] (HIVE-22629) AST Node Children can be quite
expensive to build due to List resizing
[ https://issues.apache.org/jira/browse/HIVE-22629?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16993853#comment-16993853 ]
David Mollitor edited comment on HIVE-22629 at 12/11/19 7:44 PM:
-----------------------------------------------------------------
Hey.
Why not just...
{code:java}
/*
* (non-Javadoc)
*
* @see org.apache.hadoop.hive.ql.lib.Node#getChildren()
*/
@Override
public List<Node> getChildren() {
List children = super.getChildren();
return (children == null) ? Collections.emptyList() :
Collections.unmodifiableList(new ArrayList<>(super.getChildren()));
}
{code}
Returning null "sucks". If a node has no children, the list of children should be empty. Otherwise it's ambiguous... what is an empty list v.s. null?
https://github.com/google/guava/wiki/UsingAndAvoidingNullExplained
was (Author: belugabehr):
Hey.
Why not just...
{code:java}
/*
* (non-Javadoc)
*
* @see org.apache.hadoop.hive.ql.lib.Node#getChildren()
*/
@Override
public ArrayList<Node> getChildren() {
if (super.getChildCount() == 0) {
return Collections.emptyList();
}
return Collections.unmodifiableList(new ArrayList<>(super.getChildren()));
}
{code}
Returning null "sucks". If a node has no children, the list of children should be empty. Otherwise it's ambiguous... what is an empty list v.s. null?
https://github.com/google/guava/wiki/UsingAndAvoidingNullExplained
> AST Node Children can be quite expensive to build due to List resizing
> ----------------------------------------------------------------------
>
> Key: HIVE-22629
> URL: https://issues.apache.org/jira/browse/HIVE-22629
> Project: Hive
> Issue Type: Improvement
> Reporter: Slim Bouguerra
> Assignee: Slim Bouguerra
> Priority: Major
> Attachments: HIVE-22629.patch, noETLs_ETLs_profile-kc-hdp-mstr06-p.servicemanagement.com-interactive-166620-t-e-cpu-1576029590.svg
>
>
> As per the attached profile, The AST Node can be a major source of CPU and memory churn, due to the ArrayList resizing and copy.
> In my Opinion this can be amortized by providing the actual size.
> [~jcamachorodriguez] / [~vgarg]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)