[
https://issues.apache.org/jira/browse/HIVE-22569?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16987929#comment-16987929
]
David Mollitor commented on HIVE-22569:
---------------------------------------
OK. Ya. This is worthwhile. One place in the code passes in a 'null' value
(and caused unit tests to fail) and another place passes in an empty list. I
have changed the patch so that all the callers now pass an empty list (and not
a null value). I also added checks in the constructor of
{{PrunedPartitionList}} to fail if anyone else tries to pass in a null value
again.
I also noticed, in the two constructors, that the {{ppListKey}} is an optional
field, it can be set to null. I changed the value of {{ppListKey}} to
therefore be an {{Optional}}. In doing this, I noticed that several of the
places that request the key do not ever consider that the field can be null and
are at risk for generating a NPE. I won't fix all of that now, but making the
data type {{Optional}} will at least force folks to think about it later.
> PartitionPruner use Collections Class
> -------------------------------------
>
> Key: HIVE-22569
> URL: https://issues.apache.org/jira/browse/HIVE-22569
> Project: Hive
> Issue Type: Improvement
> Reporter: David Mollitor
> Assignee: David Mollitor
> Priority: Minor
> Attachments: HIVE-22569.2.patch, HIVE.22569.1.patch
>
>
> Make class {{PrunedPartitionList.java}} more immutable. It kinda is already.
> Immutable classes are easier to reason about.
> Use {{Collections.emptyXXX}} in {{PartitionPruner}} to save an object
> instantiation at runtime.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)