924060929 commented on code in PR #64551:
URL: https://github.com/apache/doris/pull/64551#discussion_r3447862199
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/DeleteFromCommand.java:
##########
@@ -506,6 +506,19 @@ private OlapTable getTargetTable(ConnectContext ctx) {
return ((OlapTable) table);
}
+ /**
+ * check whether the target table is OLAP table.
+ */
+ public boolean isTargetTableOlap(ConnectContext ctx) {
+ try {
+ List<String> qualifiedTableName =
RelationUtil.getQualifierName(ctx, nameParts);
+ TableIf table = RelationUtil.getTable(qualifiedTableName,
ctx.getEnv(), Optional.empty());
+ return table instanceof OlapTable;
+ } catch (Exception e) {
+ return false;
+ }
+ }
Review Comment:
I think you should define a new interface `SupportProfile` and add a default
function isTargetTableOlap for reuse the code, and let the
`DeleteFromCommand` and `MergeIntoCommand` and `UpdateCommand` implements
`SupportProfile`
##########
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java:
##########
@@ -1126,6 +1127,14 @@ public boolean isProfileSafeStmt() {
return true;
}
+ // Computed DML profiles are currently only supported for OLAP target
tables.
+ if ((plan instanceof UpdateCommand && ((UpdateCommand)
plan).isTargetTableOlap(context))
+ || (plan instanceof MergeIntoCommand && ((MergeIntoCommand)
plan).isTargetTableOlap(context))
+ || (plan instanceof DeleteFromUsingCommand
Review Comment:
```java
if (plan instance of SupportProfile
&& ((SupportProfile)plan).isTargetOlapTable(context)) {
...
}
```
--
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]