This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new e4327b38f6d [fix](temp_table) fix 3 temp table issues (#55424)
e4327b38f6d is described below
commit e4327b38f6d106507bd9935c3ffd961748e85a24
Author: morrySnow <[email protected]>
AuthorDate: Fri Aug 29 11:32:33 2025 +0800
[fix](temp_table) fix 3 temp table issues (#55424)
### What problem does this PR solve?
Related PR: #55334 #55341
Problem Summary:
1. query information_schema.columns return wrong result because we skip
temporary table without add a offset to it
2. update command cannot execute on temporary table with cannot find
slot reference error
3. delete using command cannot execute on temporary table with connot
find slot reference error
the first issue intro by #55334
the second and third issues intro by #55341
---
.../doris/nereids/trees/plans/commands/DeleteFromCommand.java | 11 +++++++----
.../doris/nereids/trees/plans/commands/UpdateCommand.java | 3 ++-
.../trees/plans/commands/insert/InsertIntoTableCommand.java | 7 +++++--
.../java/org/apache/doris/service/FrontendServiceImpl.java | 3 +++
4 files changed, 17 insertions(+), 7 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/DeleteFromCommand.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/DeleteFromCommand.java
index 0b86236bad8..944378ed528 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/DeleteFromCommand.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/DeleteFromCommand.java
@@ -36,6 +36,7 @@ import org.apache.doris.catalog.PartitionType;
import org.apache.doris.catalog.TableIf;
import org.apache.doris.common.Config;
import org.apache.doris.common.ErrorCode;
+import org.apache.doris.common.util.Util;
import org.apache.doris.mysql.privilege.PrivPredicate;
import org.apache.doris.nereids.CascadesContext;
import org.apache.doris.nereids.NereidsPlanner;
@@ -167,7 +168,7 @@ public class DeleteFromCommand extends Command implements
ForwardWithSync, Expla
scan.getTable().getName(), PrivPredicate.LOAD)) {
String message =
ErrorCode.ERR_TABLEACCESS_DENIED_ERROR.formatErrorMsg("LOAD",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
- scan.getDatabase().getFullName() + ": " +
scan.getTable().getName());
+ scan.getDatabase().getFullName() + ": " +
Util.getTempTableDisplayName(scan.getTable().getName()));
throw new AnalysisException(message);
}
@@ -333,11 +334,13 @@ public class DeleteFromCommand extends Command implements
ForwardWithSync, Expla
if (!column.isKey()) {
if (table.getKeysType() == KeysType.AGG_KEYS) {
throw new AnalysisException("delete predicate on value column
only supports Unique table with"
- + " merge-on-write enabled and Duplicate table, but "
+ "Table[" + table.getName()
+ + " merge-on-write enabled and Duplicate table, but "
+ "Table["
+ + Util.getTempTableDisplayName(table.getName())
+ "] is an Aggregate table.");
} else if (table.getKeysType() == KeysType.UNIQUE_KEYS &&
!table.getEnableUniqueKeyMergeOnWrite()) {
throw new AnalysisException("delete predicate on value column
only supports Unique table with"
- + " merge-on-write enabled and Duplicate table, but "
+ "Table[" + table.getName()
+ + " merge-on-write enabled and Duplicate table, but "
+ "Table["
+ + Util.getTempTableDisplayName(table.getName())
+ "] is an unique table without merge-on-write.");
}
}
@@ -468,7 +471,7 @@ public class DeleteFromCommand extends Command implements
ForwardWithSync, Expla
List<NamedExpression> selectLists = Lists.newArrayList();
List<String> cols = Lists.newArrayList();
boolean isMow = targetTable.getEnableUniqueKeyMergeOnWrite();
- String tableName = tableAlias != null ? tableAlias :
targetTable.getName();
+ String tableName = tableAlias != null ? tableAlias :
Util.getTempTableDisplayName(targetTable.getName());
boolean hasClusterKey =
targetTable.getBaseSchema().stream().anyMatch(Column::isClusterKey);
boolean hasSyncMaterializedView = false;
// currently cluster key doesn't support partial update, so we can't
convert
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/UpdateCommand.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/UpdateCommand.java
index 9aeab4c8059..4bb08164836 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/UpdateCommand.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/UpdateCommand.java
@@ -23,6 +23,7 @@ import org.apache.doris.catalog.KeysType;
import org.apache.doris.catalog.OlapTable;
import org.apache.doris.catalog.Table;
import org.apache.doris.catalog.TableIf;
+import org.apache.doris.common.util.Util;
import org.apache.doris.nereids.analyzer.UnboundAlias;
import org.apache.doris.nereids.analyzer.UnboundSlot;
import org.apache.doris.nereids.analyzer.UnboundTableSinkCreator;
@@ -121,7 +122,7 @@ public class UpdateCommand extends Command implements
ForwardWithSync, Explainab
throw new AnalysisException("Only value columns of unique table
could be updated");
}
List<NamedExpression> selectItems = Lists.newArrayList();
- String tableName = tableAlias != null ? tableAlias :
targetTable.getName();
+ String tableName = tableAlias != null ? tableAlias :
Util.getTempTableDisplayName(targetTable.getName());
Expression setExpr = null;
for (Column column : targetTable.getFullSchema()) {
// if it sets sequence column in stream load phase, the sequence
map column is null, we query it.
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertIntoTableCommand.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertIntoTableCommand.java
index b001312597a..8ffa8884dd9 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertIntoTableCommand.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/InsertIntoTableCommand.java
@@ -28,6 +28,7 @@ import org.apache.doris.common.ErrorReport;
import org.apache.doris.common.UserException;
import org.apache.doris.common.profile.ProfileManager.ProfileType;
import org.apache.doris.common.util.DebugUtil;
+import org.apache.doris.common.util.Util;
import org.apache.doris.datasource.hive.HMSExternalTable;
import org.apache.doris.datasource.iceberg.IcebergExternalTable;
import org.apache.doris.datasource.jdbc.JdbcExternalTable;
@@ -218,7 +219,8 @@ public class InsertIntoTableCommand extends Command
implements NeedAuditEncrypti
PrivPredicate.LOAD)) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR,
"LOAD",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
- targetTableIf.getDatabase().getFullName() + "." +
targetTableIf.getName());
+ targetTableIf.getDatabase().getFullName()
+ + "." +
Util.getTempTableDisplayName(targetTableIf.getName()));
}
BuildInsertExecutorResult buildResult;
try {
@@ -515,7 +517,8 @@ public class InsertIntoTableCommand extends Command
implements NeedAuditEncrypti
PrivPredicate.LOAD)) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR,
"LOAD",
ConnectContext.get().getQualifiedUser(),
ConnectContext.get().getRemoteIP(),
- targetTableIf.getDatabase().getFullName() + "." +
targetTableIf.getName());
+ targetTableIf.getDatabase().getFullName() + "."
+ +
Util.getTempTableDisplayName(targetTableIf.getName()));
}
return targetTableIf;
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
index 339df7c8fb3..4a979950d74 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
@@ -909,6 +909,9 @@ public class FrontendServiceImpl implements
FrontendService.Iface {
for (String tableName : tables) {
TableIf table = db.getTableNullableIfException(tableName);
if (table.isTemporary()) {
+ // because we return all table names to be,
+ // so when we skip temporary table, we should add a offset
here
+ tablesOffset.add(columns.size());
continue;
}
if (table != null) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]