Skip to content

Commit

Permalink
[fix](catalog)fix db name may be null in NotificationEvent (apache#38421
Browse files Browse the repository at this point in the history
)

cause by: apache#29059
  • Loading branch information
zddr committed Jul 31, 2024
1 parent c011060 commit 95a69a1
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.doris.datasource.hive.HMSCachedClient;

import com.google.common.collect.ImmutableList;
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 @@ -79,7 +80,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 95a69a1

Please sign in to comment.