Skip to content

Commit

Permalink
[fix](catalog)fix db name may be null in NotificationEvent (#38421) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
zddr authored Aug 1, 2024
1 parent 0a7f8eb commit d36ef4e
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.doris.datasource.hive.event;

import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.hive.metastore.api.NotificationEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -75,7 +76,9 @@ protected MetastoreEvent(long eventId, String catalogName, String dbName,

protected MetastoreEvent(NotificationEvent event, String catalogName) {
this.event = event;
this.dbName = event.getDbName().toLowerCase(Locale.ROOT);
// Some events that we don't care about, dbName may be empty
String eventDbName = event.getDbName();
this.dbName = StringUtils.isEmpty(eventDbName) ? eventDbName : eventDbName.toLowerCase(Locale.ROOT);
this.tblName = event.getTableName();
this.eventId = event.getEventId();
this.eventTime = event.getEventTime() * 1000L;
Expand Down

0 comments on commit d36ef4e

Please sign in to comment.