somandal commented on code in PR #9117:
URL: https://github.com/apache/pinot/pull/9117#discussion_r933440047


##########
pinot-core/src/main/java/org/apache/pinot/core/operator/InstanceResponseOperator.java:
##########
@@ -101,10 +112,33 @@ protected InstanceResponseBlock getNextBlock() {
       responseMetaData
           .put(MetadataKey.SYSTEM_ACTIVITIES_CPU_TIME_NS.getName(), 
String.valueOf(systemActivitiesCpuTimeNs));
 
+      // TODO: Remove this once the SelectionOrderByOperator is modified to 
throw an exception to catch cases where
+      //       an MV column (identifier or via transform) is present on the 
order-by list
+      logAndEmitMetricForQueryHasMVSelectionOrderBy(intermediateResultsBlock);
+
       return instanceResponseBlock;
     } else {
-      return new InstanceResponseBlock(getCombinedResults());
+      // TODO: Remove this once the SelectionOrderByOperator is modified to 
throw an exception to catch cases where
+      //       an MV column (identifier or via transform) is present on the 
order-by list
+      IntermediateResultsBlock intermediateResultsBlock = getCombinedResults();
+      logAndEmitMetricForQueryHasMVSelectionOrderBy(intermediateResultsBlock);
+
+      return new InstanceResponseBlock(intermediateResultsBlock);
+    }
+  }
+
+  private void 
logAndEmitMetricForQueryHasMVSelectionOrderBy(IntermediateResultsBlock 
intermediateResultsBlock) {
+    if (!intermediateResultsBlock.isQueryHasMVSelectionOrderBy()) {
+      return;
+    }
+
+    String tableName = _queryContext.getTableName();
+    if (_serverMetrics != null) {
+      _serverMetrics.addMeteredTableValue(tableName, 
ServerMeter.QUERY_HAS_MV_SELECTION_ORDER_BY, 1);
     }
+    List<OrderByExpressionContext> orderByExpressions = 
_queryContext.getOrderByExpressions();
+    LOGGER.warn("Table {} has MV column in ORDER BY. Expressions: {}", 
tableName,
+        orderByExpressions == null ? "" : orderByExpressions);

Review Comment:
   okay i'll remove that, thanks!



-- 
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]

Reply via email to