codeant-ai-for-open-source[bot] commented on code in PR #43236:
URL: https://github.com/apache/superset/pull/43236#discussion_r3885481652
##########
superset/db_engine_specs/db2.py:
##########
@@ -95,21 +95,14 @@ class Db2EngineSpec(BaseEngineSpec):
_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({col})) 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",
+ TimeGrain.SECOND: "DATE_TRUNC('SECOND', {col})",
+ TimeGrain.MINUTE: "DATE_TRUNC('MINUTE', {col})",
+ TimeGrain.HOUR: "DATE_TRUNC('HOUR', {col})",
+ TimeGrain.DAY: "DATE_TRUNC('DAY', {col})",
+ TimeGrain.WEEK: "DATE_TRUNC('WEEK', {col})",
+ TimeGrain.MONTH: "DATE_TRUNC('MONTH', {col})",
+ TimeGrain.QUARTER: "DATE_TRUNC('QUARTER', {col})",
+ TimeGrain.YEAR: "DATE_TRUNC('YEAR', {col})",
Review Comment:
✅ **Customized review instruction saved!**
**Instruction:**
> Do not flag DATE_TRUNC(part, expr) mappings as incompatible for IBM Db2;
Db2 11.1 and later support the native function, and version-specific SQL
branching is not required.
**Applied to:**
- `superset/db_engine_specs/db2.py`
---
💡 *To manage or update this instruction, visit: [CodeAnt AI
Settings](https://app.codeant.ai/org/settings/learnings)*
--
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]