[
https://issues.apache.org/jira/browse/HIVE-23295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17093967#comment-17093967
]
Jason Dere commented on HIVE-23295:
-----------------------------------
+1
> Possible NPE when on getting predicate literal list when dynamic values are
> not available
> -----------------------------------------------------------------------------------------
>
> Key: HIVE-23295
> URL: https://issues.apache.org/jira/browse/HIVE-23295
> Project: Hive
> Issue Type: Bug
> Components: storage-api
> Reporter: Attila Magyar
> Assignee: Attila Magyar
> Priority: Major
> Fix For: 4.0.0
>
> Attachments: HIVE-23295.1.patch
>
>
> getLiteralList() in SearchArgumentImpl$PredicateLeafImpl returns null if
> dynamic values are not available.
> {code:java}
> @Override
> public List<Object> getLiteralList() {
> if (literalList != null && literalList.size() > 0 && literalList.get(0)
> instanceof LiteralDelegate) {
> List<Object> newLiteraList = new ArrayList<Object>();
> try {
> for (Object litertalObj : literalList) {
> Object literal = ((LiteralDelegate) litertalObj).getLiteral();
> if (literal != null) {
> newLiteraList.add(literal);
> }
> }
> } catch (NoDynamicValuesException err) {
> LOG.debug("Error while retrieving literalList, returning null", err);
> return null;
> }
> return newLiteraList;
> }
> return literalList;
> } {code}
>
> There are multiple call sites where the return value is used without a null
> check. E.g: leaf.getLiteralList().stream().
>
> The return null was added as part of HIVE-18827 to avoid having an
> unimportant warning message when dynamic values have not been delivered yet.
>
> [~sershe], [~jdere], I propose return an empty list instead of null in a case
> like this. What do you think?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)