github-actions[bot] commented on code in PR #69176:
URL: https://github.com/apache/doris/pull/69176#discussion_r4334950964
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/PositionDeleteRowLevelDmlTransform.java:
##########
@@ -209,10 +212,45 @@ public void finalizeSink(BaseExternalTableInsertExecutor
executor, RowLevelDmlOp
@Override
public Optional<ConnectorPredicate> extractWriteConstraint(Plan
analyzedPlan, TableIf table) {
+ return WriteConstraintExtractor.extract(analyzedPlan, table.getId(),
syntheticColumnExclusion(table));
+ }
+
+ @Override
+ public OptionalLong deleteUsingMetadata(ConnectContext ctx,
RowLevelDmlArgs args, Plan analyzedPlan,
+ BooleanSupplier isCancelled) {
+ TableIf table = args.getTable();
+ // The statement's predicate must be extractable *exactly*: the
connector turns it into a whole-file
+ // delete, where a dropped conjunct would drop data files that still
hold live rows. extractCompletePredicate
+ // returns empty whenever completeness cannot be proven, and the
row-level path then runs unchanged.
+ Optional<ConnectorExpression> predicate =
WriteConstraintExtractor.extractCompletePredicate(
+ analyzedPlan, table.getId(), syntheticColumnExclusion(table));
+ if (!predicate.isPresent()) {
+ return OptionalLong.empty();
+ }
+ ExternalTable externalTable = (ExternalTable) table;
+ PluginDrivenExternalCatalog catalog =
+ (PluginDrivenExternalCatalog) ((PluginDrivenExternalTable)
table).getCatalog();
+ ConnectorSession session = catalog.buildConnectorSession();
+ ConnectorMetadata metadata = PluginDrivenMetadata.get(session,
catalog.getConnector());
+ ConnectorTableHandle handle = metadata.getTableHandle(
+ session, externalTable.getRemoteDbName(),
externalTable.getRemoteName())
+ .orElseThrow(() -> new AnalysisException("Table not found: "
+ + externalTable.getRemoteDbName() + "." +
externalTable.getRemoteName()
+ + " in catalog " + catalog.getName()));
+ // Fence the fresh by-name load against a drop/recreate (or schema
rebind) that happened after analysis,
+ // exactly like the row-level write path does with its pinned
write-metadata identity.
+ PluginDrivenExternalTable.WriteSchemaSnapshot writeSchema =
+ ((PluginDrivenExternalTable) table).getWriteSchemaSnapshot();
+ String boundWriteMetadataIdentity =
+ writeSchema == null ? null :
writeSchema.getWriteMetadataIdentity();
+ return metadata.deleteUsingMetadata(session, handle, predicate,
boundWriteMetadataIdentity, isCancelled);
Review Comment:
[P2] Forward metadata deletes for Iceberg tables in HMS catalogs
For an Iceberg table accessed through a Hive/HMS catalog, `metadata` here is
`HiveConnectorMetadata` even though `getTableHandle` returns the owning
sibling's Iceberg handle. The per-handle write provider and mode checks already
forward to Iceberg, so this is a supported DELETE path, but Hive metadata has
no `deleteUsingMetadata` override and always inherits the empty result. An
otherwise eligible `DELETE FROM hms_catalog.db.iceberg_table` therefore still
scans the rows and writes position deletes/DVs, retaining the fully deleted
data files this feature is meant to remove; the same table accessed through an
Iceberg catalog gets the fast path. Add the matching foreign-handle delegation
through `siblingMetadata(session, handle)`, forwarding the predicate, bound
identity and cancellation callback, and cover this gateway route.
--
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]