bito-code-review[bot] commented on PR #44455:
URL: https://github.com/apache/superset/pull/44455#issuecomment-5754776280
<!-- Bito Reply -->
The flagged issue is correct: `temporal_columns_lookup` keys are
case-sensitive, so if a selected column's case differs from its metadata key,
the lookup fails, causing the column to be treated as unknown and preventing
the dormant grain from being omitted. To resolve this, you should normalize the
column names to a consistent case (e.g., lowercase) when performing the lookup
in `omitDormantGrain`.
Here is the suggested fix for
`superset-frontend/plugins/plugin-chart-table/src/buildQuery.ts`:
```typescript
const extras = { ...query.extras };
delete extras.time_grain_sqla;
return { ...query, extras };
}
function isPhysicalColumn(column: any): column is string {
return typeof column === 'string';
}
// Inside omitDormantGrain:
// ...
!Array.isArray(query.columns) ||
!query.columns.every(column => {
const colName = isPhysicalColumn(column) ? column.toLowerCase() : '';
const lookup = Object.fromEntries(
Object.entries(temporalColumns || {}).map(([k, v]) =>
[k.toLowerCase(), v]),
);
return colName && lookup[colName] === false;
})
// ...
```
Would you like me to fetch all other comments on this PR to validate and
implement fixes for them as well?
**superset-frontend/plugins/plugin-chart-table/src/buildQuery.ts**
```
!query.columns.every(column => {
const colName = isPhysicalColumn(column) ? column.toLowerCase() : '';
const lookup = Object.fromEntries(
Object.entries(temporalColumns || {}).map(([k, v]) =>
[k.toLowerCase(), v]),
);
return colName && lookup[colName] === false;
})
```
--
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]