rusackas commented on code in PR #45555:
URL: https://github.com/apache/superset/pull/45555#discussion_r4334910272
##########
superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts:
##########
@@ -544,7 +546,24 @@ export default function transformProps(
let displayName: string;
- if (groupby.length > 0) {
+ if (truncateMetric && groupby.length > 0) {
+ // Drop the metric part entirely and show only the groupby/dimension
+ // values, same metric-vs-dimension split the branch below uses: the
+ // label-map tuple is [metric, ...dimensions] when it has more than
+ // one entry, otherwise the whole tuple is the dimension (no metric
+ // index at all). Still apply the query-identifier suffix when asked
+ // for, or Query A and Query B become indistinguishable whenever they
+ // share a groupby value (#38451).
+ const groupbyValues =
+ labelMapValues && labelMapValues.length > 1
+ ? labelMapValues.slice(1)
+ : (labelMapValues ?? []);
Review Comment:
Good catch. The metric is now only sliced off when the query has more than
one metric, so a single metric with several groupbys keeps every dimension.
Added a test for it.
##########
superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts:
##########
@@ -544,7 +546,24 @@ export default function transformProps(
let displayName: string;
- if (groupby.length > 0) {
+ if (truncateMetric && groupby.length > 0) {
+ // Drop the metric part entirely and show only the groupby/dimension
+ // values, same metric-vs-dimension split the branch below uses: the
+ // label-map tuple is [metric, ...dimensions] when it has more than
+ // one entry, otherwise the whole tuple is the dimension (no metric
+ // index at all). Still apply the query-identifier suffix when asked
+ // for, or Query A and Query B become indistinguishable whenever they
+ // share a groupby value (#38451).
+ const groupbyValues =
+ labelMapValues && labelMapValues.length > 1
+ ? labelMapValues.slice(1)
+ : (labelMapValues ?? []);
+ const truncatedName =
+ groupbyValues.length > 0 ? groupbyValues.join(', ') : entryName;
+ displayName = showQueryIdentifiers
+ ? `${truncatedName} (Query A)`
+ : truncatedName;
Review Comment:
That collision is inherent to hiding the metric: with several metrics,
series sharing a groupby value only differ by metric, and the setting is opt-in
for exactly that tradeoff. Users who need them distinguished can leave it off.
--
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]