[ 
https://issues.apache.org/jira/browse/HIVE-9550?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sushanth Sowmyan updated HIVE-9550:
-----------------------------------
    Issue Type: Sub-task  (was: Bug)
        Parent: HIVE-7973

> ObjectStore.getNextNotification() can return events inside 
> NotificationEventResponse as null which conflicts with its thrift "required" 
> tag
> -------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-9550
>                 URL: https://issues.apache.org/jira/browse/HIVE-9550
>             Project: Hive
>          Issue Type: Sub-task
>            Reporter: Sushanth Sowmyan
>            Assignee: Sushanth Sowmyan
>             Fix For: 1.2.0
>
>         Attachments: HIVE-9550.patch
>
>
> Per hive_metastore.thrift, the "events" list inside NotificationEventResponse 
> is a required field that cannot be null.
> {code}
> struct NotificationEventResponse {
>     1: required list<NotificationEvent> events,
> }
> {code}
> However, per ObjectStore.java, this events field can be uninitialized if the 
> events retrieved from the metastore is empty instead of null:
> {code}
>       NotificationEventResponse result = new NotificationEventResponse();
>       int maxEvents = rqst.getMaxEvents() > 0 ? rqst.getMaxEvents() : 
> Integer.MAX_VALUE;
>       int numEvents = 0; 
>       while (i.hasNext() && numEvents++ < maxEvents) {
>         result.addToEvents(translateDbToThrift(i.next()));
>       }    
>       return result;
> {code}
> The fix is simple enough - we need to call result.setEvents(new 
> ArrayList<NotificationEvent>()) before we begin the iteration to do 
> result.addToEvents(...).



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

Reply via email to