rusackas commented on code in PR #43175:
URL: https://github.com/apache/superset/pull/43175#discussion_r3943101831


##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts:
##########
@@ -367,9 +367,20 @@ export default function transformProps(
   // metric. extraMetricLabels must be mapped the same way, or a sort-only
   // metric with a verbose_name set would silently fail to match here (and in
   // extractSeries below, which has the same requirement).
-  const extraMetricLabels = extractExtraMetrics(chartProps.rawFormData)
-    .map(getMetricLabel)
-    .map(label => verboseMap[label] ?? label);
+  const rawExtraMetricLabels = extractExtraMetrics(chartProps.rawFormData).map(
+    getMetricLabel,
+  );
+  const timeCompareOffsets = ensureIsArray(timeCompare).map(String);
+  const extraMetricLabels = [
+    ...rawExtraMetricLabels.map(label => verboseMap[label] ?? label),
+    // Time comparison emits a derived column per query metric and sort-only
+    // metrics are part of the query, so the sort metric's shifted column has
+    // to be excluded as well. Those columns keep the raw label with an
+    // `__<offset>` suffix rather than the verbose name.
+    ...rawExtraMetricLabels.flatMap(label =>
+      timeCompareOffsets.map(offset => `${label}__${offset}`),
+    ),

Review Comment:
   Agreed the forecast variants (`__yhat` and friends) slip through here, but I 
think that is a pre-existing gap rather than something this PR introduced... 
`master` does not exclude `sort_metric__yhat` either, since the match is exact 
on the label. I would rather not scope-creep this one, so a follow-up seems 
fine unless @bikash-barnwal wants to fold it in.



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