From 44992cb3932158c1253134bc689884abd4650fd3 Mon Sep 17 00:00:00 2001 From: Zoltan Haindrich Date: Fri, 25 Aug 2023 10:01:21 +0000 Subject: [PATCH] fix0 --- .../query/aggregation/last/StringLastBufferAggregator.java | 6 +++--- .../druid/sql/calcite/planner/CalciteRulesManager.java | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/processing/src/main/java/org/apache/druid/query/aggregation/last/StringLastBufferAggregator.java b/processing/src/main/java/org/apache/druid/query/aggregation/last/StringLastBufferAggregator.java index 8611ef72365..3f78745f5fa 100644 --- a/processing/src/main/java/org/apache/druid/query/aggregation/last/StringLastBufferAggregator.java +++ b/processing/src/main/java/org/apache/druid/query/aggregation/last/StringLastBufferAggregator.java @@ -64,9 +64,6 @@ public class StringLastBufferAggregator implements BufferAggregator @Override public void aggregate(ByteBuffer buf, int position) { - if (timeSelector.isNull()) { - return; - } if (needsFoldCheck) { // Less efficient code path when folding is a possibility (we must read the value selector first just in case // it's a foldable object). @@ -87,6 +84,9 @@ public class StringLastBufferAggregator implements BufferAggregator } } } else { + if (timeSelector.isNull()) { + return; + } final long time = timeSelector.getLong(); final long lastTime = buf.getLong(position); diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/planner/CalciteRulesManager.java b/sql/src/main/java/org/apache/druid/sql/calcite/planner/CalciteRulesManager.java index 5bf4bee733c..2e5a79d6a7c 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/planner/CalciteRulesManager.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/planner/CalciteRulesManager.java @@ -260,7 +260,10 @@ public class CalciteRulesManager boolean isDebug = plannerContext.queryContext().isDebug(); return ImmutableList.of( - Programs.sequence(preProgram, Programs.ofRules(druidConventionRuleSet(plannerContext))), + Programs.sequence(preProgram, + new LoggingProgram("Start", true), + Programs.ofRules(druidConventionRuleSet(plannerContext)), + new LoggingProgram("End", true)), Programs.sequence(preProgram, Programs.ofRules(bindableConventionRuleSet(plannerContext))), Programs.sequence( // currently, adding logging program after every stage for easier debugging