You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by va...@apache.org on 2025/03/26 20:24:02 UTC
(superset) 01/02: fix(Jinja): Emit time grain to table charts even if they don't have a temporal column
This is an automated email from the ASF dual-hosted git repository.
vavila pushed a commit to branch fix/time-grain-macro-on-table-chart
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 4e46ba8ca248c6cee12112b0150890106a83ad43
Author: Vitor Avila <vi...@preset.io>
AuthorDate: Wed Mar 26 08:35:05 2025 -0300
fix(Jinja): Emit time grain to table charts even if they don't have a temporal column
---
superset-frontend/plugins/plugin-chart-table/src/buildQuery.ts | 5 -----
superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx | 1 +
2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/superset-frontend/plugins/plugin-chart-table/src/buildQuery.ts b/superset-frontend/plugins/plugin-chart-table/src/buildQuery.ts
index 7068ab1193..5b9cb684ed 100644
--- a/superset-frontend/plugins/plugin-chart-table/src/buildQuery.ts
+++ b/superset-frontend/plugins/plugin-chart-table/src/buildQuery.ts
@@ -198,11 +198,6 @@ const buildQuery: BuildQuery<TableChartFormData> = (
(ownState.currentPage ?? 0) * (ownState.pageSize ?? 0);
}
- if (!temporalColumn) {
- // This query is not using temporal column, so it doesn't need time grain
- extras.time_grain_sqla = undefined;
- }
-
let queryObject = {
...baseQueryObject,
columns,
diff --git a/superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx b/superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx
index ef3a8e700c..4baf5f94a6 100644
--- a/superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx
+++ b/superset-frontend/plugins/plugin-chart-table/src/controlPanel.tsx
@@ -233,6 +233,7 @@ const config: ControlPanelConfig = {
name: 'time_grain_sqla',
config: {
...sharedControls.time_grain_sqla,
+ default: null,
visibility: ({ controls }) => {
const dttmLookup = Object.fromEntries(
ensureIsArray(controls?.groupby?.options).map(option => [