You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "marcioibm (via GitHub)" <gi...@apache.org> on 2026/02/23 16:14:28 UTC
[PR] fix(pivot-table): fix wrong date parse resulting in 0NaN [superset]
marcioibm opened a new pull request, #38191:
URL: https://github.com/apache/superset/pull/38191
### SUMMARY
Pivot Table was showing 0NaN columns and rows when using Date/Timestamp data because date formatters expects Date or Number as a param and string was being used instead.
This fix just enforces Number casting before calling format.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before
<img width="2048" height="1113" alt="image" src="https://github.com/user-attachments/assets/993f8116-f61d-457e-a1cb-a920badad91c" />
After
<img width="1600" height="782" alt="image" src="https://github.com/user-attachments/assets/b1f0fefc-4a08-472c-ad67-464d26f514e7" />
### TESTING INSTRUCTIONS
1. Load default dev environment
2. Create a Pivot Table chart with a timestamp / date column or row
3. Check for correct date display
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
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
Re: [PR] fix(pivot-table): fix wrong date parse resulting in 0NaN [superset]
Posted by "marcioibm (via GitHub)" <gi...@apache.org>.
marcioibm commented on PR #38191:
URL: https://github.com/apache/superset/pull/38191#issuecomment-4007005094
> @marcioibm do you mind adding tests to make sure existing functionality isn't broken with this PR?
Just did it!
--
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
Re: [PR] fix(pivot-table): fix wrong date parse resulting in 0NaN [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on PR #38191:
URL: https://github.com/apache/superset/pull/38191#issuecomment-3999397317
@marcioibm do you mind adding tests to make sure existing functionality isn't broken with this PR?
--
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
Re: [PR] fix(pivot-table): fix wrong date parse resulting in 0NaN [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #38191:
URL: https://github.com/apache/superset/pull/38191#issuecomment-3945756073
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
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
Re: [PR] fix(pivot-table): fix wrong date parse resulting in 0NaN [superset]
Posted by "syafiqmuda (via GitHub)" <gi...@apache.org>.
syafiqmuda commented on PR #38191:
URL: https://github.com/apache/superset/pull/38191#issuecomment-3995156766
so does this issue already being fix?
<img width="1631" height="735" alt="image" src="https://github.com/user-attachments/assets/802ef834-c505-424c-b96b-f3a5786eb7f5" />
--
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
Re: [PR] fix(pivot-table): fix wrong date parse resulting in 0NaN [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #38191:
URL: https://github.com/apache/superset/pull/38191#issuecomment-4025490337
<!-- Bito Reply -->
The PR assumes Unix timestamps as numeric strings (e.g., '1700000000000') for date formatting, casting them to numbers. If the data might include ISO strings with 'T' or timezone info, additional parsing could be needed, but the current tests focus on numeric timestamps.
--
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
Re: [PR] fix(pivot-table): fix wrong date parse resulting in 0NaN [superset]
Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #38191:
URL: https://github.com/apache/superset/pull/38191#issuecomment-4006863329
### <span aria-hidden="true">β
</span> Deploy Preview for *superset-docs-preview* ready!
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">π¨</span> Latest commit | 08efa26adaff7c0271b4abcabd61420480306967 |
|<span aria-hidden="true">π</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/69a9c8ecbb43790008e7abfa |
|<span aria-hidden="true">π</span> Deploy Preview | [https://deploy-preview-38191--superset-docs-preview.netlify.app](https://deploy-preview-38191--superset-docs-preview.netlify.app) |
|<span aria-hidden="true">π±</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br /><br /><br />_Use your smartphone camera to open QR code link._</details> |
---
<!-- [superset-docs-preview Preview](https://deploy-preview-38191--superset-docs-preview.netlify.app) -->
_To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._
--
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
Re: [PR] fix(pivot-table): fix wrong date parse resulting in 0NaN [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #38191:
URL: https://github.com/apache/superset/pull/38191#discussion_r2906899080
##########
superset-frontend/plugins/plugin-chart-pivot-table/test/react-pivottable/tableRenders.test.tsx:
##########
@@ -589,3 +589,88 @@ test('values ββfrom the 3rd level of the hierarchy with a subtotal at the to
},
});
});
+
+test('casts column header key to number before date formatting', () => {
+ const colDateFormatter = jest.fn().mockReturnValue('formatted-column-date');
+ tableRenderer = new TableRenderer({
+ ...mockProps,
+ cols: ['event_time'],
+ tableOptions: {
+ ...mockProps.tableOptions,
+ dateFormatters: {
+ event_time: colDateFormatter,
+ },
+ },
+ });
+
+ const pivotSettings = {
+ rowAttrs: [],
+ colAttrs: ['event_time'],
+ colKeys: [['1700000000000']],
Review Comment:
Is this always the format we'll be encountering here?
Shouldn't we also be expecting (and testing) timezoned timestamps with T / TZ / etc. in them?
--
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
Re: [PR] fix(pivot-table): fix wrong date parse resulting in 0NaN [superset]
Posted by "justinpark (via GitHub)" <gi...@apache.org>.
justinpark commented on code in PR #38191:
URL: https://github.com/apache/superset/pull/38191#discussion_r2991955586
##########
superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.tsx:
##########
@@ -843,7 +843,7 @@ export class TableRenderer extends Component<
);
};
const headerCellFormattedValue =
- dateFormatters?.[attrName]?.(colKey[attrIdx]) ?? colKey[attrIdx];
+ dateFormatters?.[attrName]?.(Number(colKey[attrIdx])) ?? colKey[attrIdx];
Review Comment:
This approach seems likely to cause issues when formatting string (str) values (for example, 'Dec. 16 2020'). How about creating and using a function that converts to a number only when the string
is a numeric string?
```suggestion
function convertToNumberIfNumeric(value: string) {
if (value.trim() !== '' && !isNaN(value)) {
return Number(value);
}
return value
}
dateFormatters?.[attrName]?.(convertToNumberIfNumeric(colKey[attrIdx])) ?? colKey[attrIdx];
```
--
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
Re: [PR] fix(pivot-table): fix wrong date parse resulting in 0NaN [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #38191:
URL: https://github.com/apache/superset/pull/38191#issuecomment-4007190138
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</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: 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
Re: [PR] fix(pivot-table): fix wrong date parse resulting in 0NaN [superset]
Posted by "marcioibm (via GitHub)" <gi...@apache.org>.
marcioibm commented on PR #38191:
URL: https://github.com/apache/superset/pull/38191#issuecomment-4155030377
Guys, sorry about the delay, crazy weeks at work. @michael-s-molina thank you for your support! i'm assuming i should close this pr, right?
--
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
Re: [PR] fix(pivot-table): fix wrong date parse resulting in 0NaN [superset]
Posted by "marcioibm (via GitHub)" <gi...@apache.org>.
marcioibm commented on PR #38191:
URL: https://github.com/apache/superset/pull/38191#issuecomment-3946182897
> ### Code Review Agent Run #5280d3
> Actionable Suggestions - 0
> Additional Suggestions - 1
> * superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.tsx - 1
>
> * Broken string temporal formatting Β· [Line 846-846](https://github.com/apache/superset/pull/38191/files#diff-2262a1df103fda91ff939105e998b8a96ed3e05ad84d75d8c5afcc13c5b899fdR846)
> Use `Number(v)` when it yields a valid number and fallback to the original value on NaN. For example:
> ```js
> const n = Number(v);
> const headerCellFormattedValue = dateFormatters?.[attrName]?.(isNaN(n) ? v : n) ?? v;
> ```
>
> Review Details
> * Files reviewed - 1 Β· Commit Range: `7735e28..8163ae8`
>
> * superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.tsx
> * Files skipped - 0
> * Tools
>
> * Whispers (Secret Scanner) - βοΈ Successful* Detect-secrets (Secret Scanner) - βοΈ Successful
>
> Bito Usage Guide
> **Commands**
>
> Type the following command in the pull request comment and save the comment.
>
> * `/review` - Manually triggers a full AI review.
> * `/pause` - Pauses automatic reviews on this pull request.
> * `/resume` - Resumes automatic reviews.
> * `/resolve` - Marks all Bito-posted review comments as resolved.
> * `/abort` - Cancels all in-progress reviews.
>
> Refer to the [documentation](https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands) for additional commands.
>
> **Configuration**
>
> This repository uses `Superset` You can customize the agent settings [here](https://alpha.bito.ai/home/ai-agents/code-review-agent) or contact your Bito workspace admin at [evan@preset.io](mailto:evan@preset.io).
>
> **Documentation & Help**
>
> * [Customize agent settings](https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance)
> * [Review rules](https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules)
> * [General documentation](https://docs.bito.ai/bito-dev-agents/ai-code-review-agent)
> * [FAQ](https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs)
>
> AI Code Review powered by [<img alt="Bito Logo" width="50" height="20" src="https://camo.githubusercontent.com/810f9c950a15f18a9a21d4e214820ef360ea3b08a4b5dea95d24529fffd09ed6/68747470733a2f2f6269746f2e61692f77702d636f6e74656e742f75706c6f6164732f323032332f31302f4c6f676f2d4269746f2d426c61636b2d63726f707065642e737667">](https://bito.ai/)
The suggested behavior happens when trying to format an invalid number and fallbacks to String!
--
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
Re: [PR] fix(pivot-table): fix wrong date parse resulting in 0NaN [superset]
Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina closed pull request #38191: fix(pivot-table): fix wrong date parse resulting in 0NaN
URL: https://github.com/apache/superset/pull/38191
--
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
Re: [PR] fix(pivot-table): fix wrong date parse resulting in 0NaN [superset]
Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina commented on PR #38191:
URL: https://github.com/apache/superset/pull/38191#issuecomment-4154941297
@marcioibm Given that you don't have "Allow edits from maintainers" enabled, I was not able to push to your PR. I opened https://github.com/apache/superset/pull/38953 to push the changes and credited the fix to you in the PR description.
--
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