From 0f6ec97ac5349cf697d6820d467a9fa1d78a1291 Mon Sep 17 00:00:00 2001 From: Bahram Zaeri Date: Thu, 16 Jan 2025 00:20:03 +0000 Subject: [PATCH] add method `recordUpdatedPositions` to the OperatorContext class --- .../src/main/java/io/trino/operator/OperatorContext.java | 6 ++++++ .../main/java/io/trino/operator/TableMutationOperator.java | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/trino-main/src/main/java/io/trino/operator/OperatorContext.java b/core/trino-main/src/main/java/io/trino/operator/OperatorContext.java index 3e7106f3005a..85e5396fdfff 100644 --- a/core/trino-main/src/main/java/io/trino/operator/OperatorContext.java +++ b/core/trino-main/src/main/java/io/trino/operator/OperatorContext.java @@ -227,6 +227,12 @@ public void recordDynamicFilterSplitProcessed(long dynamicFilterSplits) dynamicFilterSplitsProcessed.getAndAdd(dynamicFilterSplits); } + public void recordUpdatedPositions(long updatedPositions) + { + checkArgument(updatedPositions >= 0, "updatedPositions is negative (%s)", updatedPositions); + this.updatedPositions.update(updatedPositions); + } + /** * Overwrites the metrics with the latest one. * diff --git a/core/trino-main/src/main/java/io/trino/operator/TableMutationOperator.java b/core/trino-main/src/main/java/io/trino/operator/TableMutationOperator.java index 8931e64b0765..00fb19166675 100644 --- a/core/trino-main/src/main/java/io/trino/operator/TableMutationOperator.java +++ b/core/trino-main/src/main/java/io/trino/operator/TableMutationOperator.java @@ -121,7 +121,7 @@ public Page getOutput() OptionalLong rowsUpdatedCount = operation.execute(); - operatorContext.getUpdatedPositions().update(rowsUpdatedCount.orElse(0L)); + operatorContext.recordUpdatedPositions(rowsUpdatedCount.orElse(0L)); return buildUpdatedCountPage(rowsUpdatedCount); }