fix(box-plot): distribute across field not marked as required for datasets without a temporal column - #43087
fix(box-plot): distribute across field not marked as required for datasets without a temporal column#43087vhogberg wants to merge 1 commit into
Conversation
…asets without a temporal column
Code Review Agent Run #2a8abbActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
| const { defaultTemporalColumn } = getTemporalColumns( | ||
| state.datasource, | ||
| ); | ||
| return defaultTemporalColumn ? [defaultTemporalColumn] : []; |
There was a problem hiding this comment.
Suggestion: The helper returns main_dttm_col without verifying that it still exists in the datasource's temporal columns. Datasources can retain a stale main_dttm_col after that column is changed to non-temporal or removed, so this code will populate columns with an invalid distribution column and allow the query to proceed with an invalid field instead of leaving the control empty or selecting a valid temporal column. Ensure defaultTemporalColumn is present in the returned temporal-column list before using it. [api mismatch]
Severity Level: Major ⚠️
- ❌ Box Plot queries fail with stale column metadata.
- ⚠️ Explore auto-selects unavailable distribution columns.
- ⚠️ Dataset edits can leave main temporal metadata inconsistent.Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/controlPanel.ts
**Line:** 198:201
**Comment:**
*Api Mismatch: The helper returns `main_dttm_col` without verifying that it still exists in the datasource's temporal columns. Datasources can retain a stale `main_dttm_col` after that column is changed to non-temporal or removed, so this code will populate `columns` with an invalid distribution column and allow the query to proceed with an invalid field instead of leaving the control empty or selecting a valid temporal column. Ensure `defaultTemporalColumn` is present in the returned temporal-column list before using it.
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.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fixThere was a problem hiding this comment.
This seems like pre-existing behavior of the getTemporalColumns helper, not introduced by this PR, and it affects every caller of the helper. In my opinion it's out of scope for this PR and should be fixed separately if needed in getTemporalColumns itself, so that it's fixed globally.
There was a problem hiding this comment.
✅ Customized review instruction saved!
Instruction:
When a finding originates from shared helper behavior that predates the change, report it against the helper for a global fix rather than flagging individual callers.
Applied to:
**/getTemporalColumns*
💡 To manage or update this instruction, visit: CodeAnt AI Settings
|
The flagged issue is correct. The current implementation assumes const { defaultTemporalColumn } = getTemporalColumns(
state.datasource,
);
return defaultTemporalColumn ? [defaultTemporalColumn] : [];This change ensures that if no valid temporal column is found, the control remains empty instead of returning an invalid field. There are no other comments on this PR to address. superset-frontend/plugins/plugin-chart-echarts/src/BoxPlot/controlPanel.ts |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #43087 +/- ##
=======================================
Coverage 66.64% 66.64%
=======================================
Files 2863 2863
Lines 162112 162113 +1
Branches 37384 37385 +1
=======================================
+ Hits 108033 108040 +7
+ Misses 52021 52015 -6
Partials 2058 2058
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
rusackas
left a comment
There was a problem hiding this comment.
Matches the repo, has solid tests, CI is green aside from some flakiness (I'll try to fix). LGTM
SUMMARY
Fixes #43086
Distribute acrossis validated withvalidateNonEmpty, butinitialValuereturned[undefined]when the dataset has no temporal column. An array of length 1 passesvalidateNonEmpty, so the control was never flagged as required and running the chartfailed with an unclear query error instead. Now an empty array is returned in that case.
Added a test in a new controlPanel.test.ts file.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
->
(note that I have renamed the field to "unique identifier" in my fork, not included in the PR)
TESTING INSTRUCTIONS
Distribute acrossismarked required immediately now.
ADDITIONAL INFORMATION