You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by ja...@apache.org on 2026/09/29 17:08:28 UTC
(asterixdb) branch master updated: [NO ISSUE][API] Count all warnings per statement
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git
The following commit(s) were added to refs/heads/master by this push:
new f3d873be59 [NO ISSUE][API] Count all warnings per statement
f3d873be59 is described below
commit f3d873be59bb70a3f756986110516435c322b3d0
Author: Janhavi Tripurwar <ja...@couchbase.com>
AuthorDate: Mon Sep 28 11:21:16 2026 +0530
[NO ISSUE][API] Count all warnings per statement
- user model changes: no
- storage format changes: no
- interface changes: no
Details: the warning count recorded in a statement's StatementInfo
was taken from the warning collector, which sees only the warnings a
job hands back - at most max-warnings of them, deduplicated - rather
than the count the job reports.
The statement now takes its share of the request's warning count, as
it does its row count and size.
Ext-ref: MB-74218
Co-Authored-By: Claude Opus 5.5 (1M context) <no...@anthropic.com>
Change-Id: I007573a571c5fda1e365798ebe9df088e359bfc9
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21914
Reviewed-by: Janhavi Tripurwar <ja...@apache.org>
Reviewed-by: Ali Alsuliman <al...@gmail.com>
Tested-by: Janhavi Tripurwar <ja...@apache.org>
---
.../java/org/apache/asterix/translator/IStatementExecutor.java | 9 ++++-----
.../org/apache/asterix/app/translator/QueryTranslator.java | 10 ++++------
2 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/IStatementExecutor.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/IStatementExecutor.java
index 98b2a641a0..446b5cb9c5 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/IStatementExecutor.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/IStatementExecutor.java
@@ -421,16 +421,15 @@ public interface IStatementExecutor {
}
/**
- * What the statement that ran since {@code before} contributed. Only the row count and size accumulate over a
- * request; every other figure describes one job, so it is already this statement's - or, where it has not
- * changed, belongs to an earlier statement and this one produced none of its own.
+ * What the statement that ran since {@code before} contributed. Only the row count, size and warning count
+ * accumulate over a request; every other figure describes one job, so it is already this statement's - or,
+ * where it has not changed, belongs to an earlier statement and this one produced none of its own.
*/
public Stats since(Stats before) {
Stats delta = snapshot();
delta.count -= before.count;
delta.size -= before.size;
- // set where the warnings are attributed: the request's total counts earlier statements more than once
- delta.totalWarningsCount = 0;
+ delta.totalWarningsCount -= before.totalWarningsCount;
delta.compileTime = ownOrNone(compileTime, before.compileTime);
delta.queueWaitTime = ownOrNone(queueWaitTime, before.queueWaitTime);
delta.processedObjects = ownOrNone(processedObjects, before.processedObjects);
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
index 9c3e8e9b2f..3826f8376b 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
@@ -756,8 +756,6 @@ public class QueryTranslator extends AbstractLangTranslator implements IStatemen
List<Warning> warningsNow = requestWarnings();
statementInfo.addWarnings(
warningsNow.subList(Math.min(warningsBeforeStatement.size(), warningsNow.size()), warningsNow.size()));
- statementStats
- .updateTotalWarningsCount(warningCollector.getTotalWarningsCount() - warningsRaisedBeforeStatement);
statementInfo.setStats(statementStats);
}
@@ -4754,8 +4752,8 @@ public class QueryTranslator extends AbstractLangTranslator implements IStatemen
final JobSpecification jobSpec = apiFramework.compileQuery(hcc, metadataProvider, copyTo.getQuery(),
rewrittenResult.getRight(), null, sessionOutput, compiledCopyToStatement, externalVars,
responsePrinter, warningCollector, requestParameters, jobFlags, null);
- // update stats with count of compile-time warnings. needs to be adapted for multi-statement.
- stats.updateTotalWarningsCount(warningCollector.getTotalWarningsCount());
+ stats.updateTotalWarningsCount(
+ warningCollector.getTotalWarningsCount() - warningsRaisedBeforeStatement);
afterCompile();
MetadataManager.INSTANCE.commitTransaction(mdTxnCtx);
stats.setCompileTimeNanos(System.nanoTime() - compileStart);
@@ -6084,8 +6082,8 @@ public class QueryTranslator extends AbstractLangTranslator implements IStatemen
}
}
- // update stats with count of compile-time warnings. needs to be adapted for multi-statement.
- stats.updateTotalWarningsCount(warningCollector.getTotalWarningsCount());
+ stats.updateTotalWarningsCount(
+ warningCollector.getTotalWarningsCount() - warningsRaisedBeforeStatement);
afterCompile();
MetadataManager.INSTANCE.commitTransaction(mdTxnCtx);
stats.setCompileTimeNanos(System.nanoTime() - compileStart);