morrySnow commented on code in PR #57857:
URL: https://github.com/apache/doris/pull/57857#discussion_r2523333898
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java:
##########
@@ -463,16 +463,28 @@ public boolean registerTable(TableIf table) {
boolean result = true;
Table olapTable = (Table) table;
olapTable.setQualifiedDbName(fullQualifiedName);
- String tableName = olapTable.getName();
+ String tableName = olapTable.getName(); // stored (internal for temp)
+ String displayNameLower = null;
+ if (olapTable.isTemporary()) {
+ // derive display name (without session + #TEMP#) for reverse
lookup
+ String display = Util.getTempTableDisplayName(tableName);
+ displayNameLower = display.toLowerCase();
+ }
+ String lookupName = tableName;
if (Env.isStoredTableNamesLowerCase()) {
- tableName = tableName.toLowerCase();
+ lookupName = lookupName.toLowerCase();
}
- if (isTableExist(tableName)) {
+ if (isTableExist(lookupName)) {
result = false;
} else {
idToTable.put(olapTable.getId(), olapTable);
nameToTable.put(olapTable.getName(), olapTable);
- lowerCaseToTableName.put(tableName.toLowerCase(), tableName);
+ lowerCaseToTableName.put(lookupName.toLowerCase(), tableName);
+ // In stored-lowercase mode (1), user will query by display name.
+ // Add mapping from display lower-case name to internal temp name
so getTableNullable(display) succeeds.
+ if (olapTable.isTemporary() && displayNameLower != null) {
+ lowerCaseToTableName.put(displayNameLower, tableName);
Review Comment:
Because Doris allows creating temporary tables with the same name as regular
tables, the temporary table name (with its prefix removed) cannot be directly
stored in this map.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]