[ 
https://issues.apache.org/jira/browse/HIVE-9609?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14311094#comment-14311094
 ] 

Sushanth Sowmyan commented on HIVE-9609:
----------------------------------------

Ideally, I'd like to fix this by changing AddPartitionEvent.getPartitions() to 
return an Iterable<Partition>, and make that work either way, but I'm not 
certain if I will tread on any toes if I change that, since this has been 
public interface for a while - also, I'm not certain if expecting "null" from 
getPartitions might be used in any code to determine if this is a 
List<Partition> based or PartitionSpec-based AddPartitionEvent. So, I've not 
messed with the current implementation of getPartitions. That said, [~mithun], 
could you please comment if you're okay with me fixing getPartitions so that it 
doesn't return null in the case where it has been instantiated from a 
PartitionSpec? I could at the very least do that.

Also, to handle the base problem, we should fix 
AddPartitionEvent.getPartitionIterator to correctly work in correctly in both 
cases - this should at least not be controversial.

After that, we should change MessageFactory.buildAddPartitionMessage to work on 
Iterator<Partition> rather than List<Partition> - this is trivially fixable, 
and have JSONMessageFactory use that instead, thereby solving our initial 
problem of getPartitions call from AddPartitionEvent not being usable in cases 
of events fired with PartitionSpec rather than List<Partition>

> AddPartitionMessage.getPartitions() can return null
> ---------------------------------------------------
>
>                 Key: HIVE-9609
>                 URL: https://issues.apache.org/jira/browse/HIVE-9609
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Sushanth Sowmyan
>            Assignee: Sushanth Sowmyan
>
> DbNotificationListener and NotificationListener both depend on 
> AddPartitionEvent.getPartitions() to get their partitions to trigger a 
> message, but this can be null if an AddPartitionEvent was initialized on a 
> PartitionSpec rather than a List<Partition>.
> Also, AddPartitionEvent seems to have a duality, where getPartitions() works 
> only if instantiated on a List<Partition>, and getPartitionIterator() works 
> only if instantiated on a PartitionSpec.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to