bito-code-review[bot] commented on code in PR #42144:
URL: https://github.com/apache/superset/pull/42144#discussion_r3609410118
##########
superset/mcp_service/dataset/schemas.py:
##########
@@ -807,6 +807,22 @@ class QueryDatasetFilter(BaseModel):
)
+# Bracket shorthands (e.g. "[year]", "[quarter]") are not a Superset
+# time-range grammar — they appear when an LLM copies a grain token from a
+# dashboard filter context. Map them to the equivalent "Last <unit>" form
+# that get_since_until() does support.
+_BRACKET_SHORTHAND_TO_TIME_RANGE: dict[str, str] = {
+ "[second]": "Last second",
+ "[minute]": "Last minute",
+ "[hour]": "Last hour",
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Unusable time-range mappings</b></div>
<div id="fix">
Entries mapping to 'Last second' / 'Last minute' / 'Last hour' are
unreachable. The time_range_lookup pattern in get_since_until() (date_parser.py
line 621) only accepts 'second|minute|day|week|month|quarter|year' — 'hour' is
absent. These values will fall through to DATETIME('Last hour') and raise
TimeRangeParseFailError, defeating the normalization goal.
</div>
</div>
<small><i>Code Review Run #f690ad</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid 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: [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]