You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "Copilot (via GitHub)" <gi...@apache.org> on 2025/08/05 03:10:36 UTC
Re: [PR] fix(dashboard): fixed first/last aggregations in pivot tables [superset]
Copilot commented on code in PR #33275:
URL: https://github.com/apache/superset/pull/33275#discussion_r2253003839
##########
superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/utilities.js:
##########
@@ -274,15 +274,9 @@ const baseAggregatorTemplates = {
this.val !== null ? this.val : coercedValue,
);
}
- } else if (
- mode === 'first' &&
- this.sorter(x, this.val !== null ? this.val : x) <= 0
- ) {
- this.val = x;
- } else if (
- mode === 'last' &&
- this.sorter(x, this.val !== null ? this.val : x) >= 0
- ) {
+ } else if (mode === 'first') {
+ this.val = this.val === null ? x : this.val;
Review Comment:
The 'first' mode logic is incorrect. It should capture the first value encountered, but this implementation will keep the first non-null value and ignore subsequent values even if the initial value was null. Consider using a separate flag to track if any value has been set: `if (this.val === null) { this.val = x; }`
```suggestion
if (!this.hasValue) {
this.val = x;
this.hasValue = true;
}
```
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org