codeant-ai-for-open-source[bot] commented on code in PR #37068:
URL: https://github.com/apache/superset/pull/37068#discussion_r2684590350
##########
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.tsx:
##########
@@ -357,7 +357,7 @@ function BigNumberVis({
const pointerEvent = eventParams.event.event;
const drillToDetailFilters: BinaryQueryObjectFilterClause[] = [];
drillToDetailFilters.push({
- col: formData?.granularitySqla,
+ col: formData?.granularitySqla || formData?.xAxis,
Review Comment:
**Suggestion:** Logic error: the code prefers the time-granularity column
(`granularitySqla`) over the actual x-axis column (`xAxis`) when building the
drill filter `col`. This will create filters on the wrong column (time column)
instead of the plotted x-axis dimension and produce incorrect drill-to-detail
behavior. Swap the preference so `xAxis` is used first and fall back to
`granularitySqla`. [logic error]
**Severity Level:** Minor ⚠️
```suggestion
col: formData?.xAxis || formData?.granularitySqla,
```
<details>
<summary><b>Why it matters? ⭐ </b></summary>
The current code prioritizes the time-grain column (granularitySqla) over
the actual plotted x-axis (xAxis), which likely causes drill filters to target
the time column instead of the dimension used on the x-axis. Swapping
precedence to prefer xAxis fixes the logic so drills apply to the correct
column. This is a focused correctness fix, no broad refactor required.
</details>
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.tsx
**Line:** 360:360
**Comment:**
*Logic Error: Logic error: the code prefers the time-granularity column
(`granularitySqla`) over the actual x-axis column (`xAxis`) when building the
drill filter `col`. This will create filters on the wrong column (time column)
instead of the plotted x-axis dimension and produce incorrect drill-to-detail
behavior. Swap the preference so `xAxis` is used first and fall back to
`granularitySqla`.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
```
</details>
--
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]