bito-code-review[bot] commented on code in PR #43236:
URL: https://github.com/apache/superset/pull/43236#discussion_r4086946211
##########
superset/db_engine_specs/ibmi.py:
##########
@@ -28,6 +30,25 @@ class IBMiEngineSpec(Db2EngineSpec):
engine_name = "IBM Db2 for i"
max_column_name_length = 128
+ _time_grain_expressions = {
+ None: "{col}",
+ TimeGrain.SECOND: "CAST({col} as TIMESTAMP) - MICROSECOND({col})
MICROSECONDS",
+ TimeGrain.MINUTE: "CAST({col} as TIMESTAMP)"
+ " - SECOND({col}) SECONDS"
+ " - MICROSECOND({col}) MICROSECONDS",
+ TimeGrain.HOUR: "CAST({col} as TIMESTAMP)"
+ " - MINUTE({col}) MINUTES"
+ " - SECOND({col}) SECONDS"
+ " - MICROSECOND({col}) MICROSECONDS ",
+ TimeGrain.DAY: "DATE({col})",
+ TimeGrain.WEEK: "{col} - (DAYOFWEEK_ISO({col})-1) DAYS",
+ TimeGrain.MONTH: "{col} - (DAY({col})-1) DAYS",
+ TimeGrain.QUARTER: "{col} - (DAY({col})-1) DAYS"
+ " - (MONTH({col})-1) MONTHS"
+ " + ((QUARTER({col})-1) * 3) MONTHS",
+ TimeGrain.YEAR: "{col} - (DAY({col})-1) DAYS - (MONTH({col})-1)
MONTHS",
Review Comment:
<!-- Bito Reply -->
The suggestion is technically correct for ensuring that time-of-day
components are truncated when using these time grains, which prevents issues
with GROUP BY bucketing. Since the behavior on IBM i is unchanged for these
specific expressions and the PR is already merged, it is acceptable to resolve
this comment without applying the change, as you have noted.
**superset/db_engine_specs/ibmi.py**
```
TimeGrain.WEEK: "DATE({col}) - (DAYOFWEEK_ISO({col})-1) DAYS",
TimeGrain.MONTH: "DATE({col}) - (DAY({col})-1) DAYS",
TimeGrain.QUARTER: "DATE({col}) - (DAY({col})-1) DAYS"
" - (MONTH({col})-1) MONTHS"
" + ((QUARTER({col})-1) * 3) MONTHS",
TimeGrain.YEAR: "DATE({col}) - (DAY({col})-1) DAYS -
(MONTH({col})-1) MONTHS",
```
--
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]