Skip to content

Commit

Permalink
[Bug] When using the hive catalog the hive table name is uppercase, t…
Browse files Browse the repository at this point in the history
…he Doris query is reported wrong apache#29058 (apache#29059)
  • Loading branch information
LuGuangming authored and HappenLee committed Jan 12, 2024
1 parent fd77fa2 commit 5012b59
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// specific language governing permissions and limitations
// under the License.


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

import org.apache.doris.catalog.Env;
Expand All @@ -29,6 +28,7 @@

import java.security.SecureRandom;
import java.util.List;
import java.util.Locale;

/**
* MetastoreEvent for ALTER_TABLE event type
Expand Down Expand Up @@ -65,6 +65,7 @@ private AlterTableEvent(NotificationEvent event, String catalogName) {
(JSONAlterTableMessage) MetastoreEventsProcessor.getMessageDeserializer(event.getMessageFormat())
.getAlterTableMessage(event.getMessage());
tableAfter = Preconditions.checkNotNull(alterTableMessage.getTableObjAfter());
tableAfter.setTableName(tableAfter.getTableName().toLowerCase(Locale.ROOT));
tableBefore = Preconditions.checkNotNull(alterTableMessage.getTableObjBefore());
tblNameAfter = tableAfter.getTableName();
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// specific language governing permissions and limitations
// under the License.


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

import org.apache.doris.catalog.Env;
Expand All @@ -28,6 +27,7 @@
import org.apache.hadoop.hive.metastore.messaging.CreateTableMessage;

import java.util.List;
import java.util.Locale;

/**
* MetastoreEvent for CREATE_TABLE event type
Expand All @@ -51,6 +51,7 @@ private CreateTableEvent(NotificationEvent event, String catalogName) throws Met
MetastoreEventsProcessor.getMessageDeserializer(event.getMessageFormat())
.getCreateTableMessage(event.getMessage());
hmsTbl = Preconditions.checkNotNull(createTableMessage.getTableObj());
hmsTbl.setTableName(hmsTbl.getTableName().toLowerCase(Locale.ROOT));
} catch (Exception e) {
throw new MetastoreNotificationException(
debugString("Unable to deserialize the event message"), e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// specific language governing permissions and limitations
// under the License.


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

import org.apache.doris.datasource.hive.HMSCachedClient;
Expand All @@ -25,6 +24,7 @@
import org.apache.logging.log4j.Logger;

import java.util.List;
import java.util.Locale;
import java.util.Map;

/**
Expand Down Expand Up @@ -77,7 +77,7 @@ protected MetastoreEvent(long eventId, String catalogName, String dbName,

protected MetastoreEvent(NotificationEvent event, String catalogName) {
this.event = event;
this.dbName = event.getDbName();
this.dbName = event.getDbName().toLowerCase(Locale.ROOT);
this.tblName = event.getTableName();
this.eventId = event.getEventId();
this.eventTime = event.getEventTime() * 1000L;
Expand Down

0 comments on commit 5012b59

Please sign in to comment.