Sushanth Sowmyan created HIVE-9550:
--------------------------------------
Summary: 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: Bug
Reporter: Sushanth Sowmyan
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)