[ https://issues.apache.org/jira/browse/HIVE-22629?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16993853#comment-16993853 ]
David Mollitor commented on HIVE-22629: --------------------------------------- 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)