aminghadersohi opened a new pull request, #44105:
URL: https://github.com/apache/superset/pull/44105

   ### SUMMARY
   
   The query engine resolves a relative time range to concrete bounds, but MCP 
discarded them. Callers could not tell which range produced the numbers: a 
model can narrate one range while the query used another.
   
   Verified on `master`: `from_dttm`/`to_dttm` appear nowhere in 
`superset/mcp_service/`, while `superset/common/query_context_processor.py` 
computes the result payload containing those resolved bounds.
   
   Both `query_dataset` and `get_table` return `from_dttm` (inclusive) and 
`to_dttm` (exclusive), including on cached and empty results. The response 
schemas and tool documentation explain how to report these ISO 8601 values. 
Missing primary bounds remain null.
   
   **What this does not do:** no parser change; no year-offset bug was found. 
Callers can identify the engine's primary logical range, not every additional 
SQL filter or timezone-adjusted boundary. These fields are not observed row 
minima/maxima, and naive timestamps are not asserted to be UTC. Additional 
column filters, virtual dataset SQL, and semantic-view one-sided ranges 
rewritten as comparison filters can still constrain results.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Not applicable (MCP response metadata only).
   
   Before: the request's relative expression was available, but the resolved 
primary bounds were omitted.
   
   After: for example, `previous calendar month` evaluated on July 17, 2026 
returns `from_dttm: "2026-06-01T00:00:00"` and `to_dttm: "2026-07-01T00:00:00"` 
(exclusive).
   
   ### TESTING INSTRUCTIONS
   
   - Run `pytest -q 
tests/unit_tests/mcp_service/dataset/tool/test_query_dataset.py 
tests/unit_tests/mcp_service/semantic_layer/tool/test_get_table.py`.
   - With MCP configured, query a temporal dataset using `query_dataset` and a 
relative `time_range`; compare the returned bounds with the engine result and 
generated primary time predicate.
   - Repeat using `get_table` for a built-in dataset and an external semantic 
view.
   - Repeat with a cache hit and with a query returning zero rows. Both fields 
should remain present and reflect the engine payload.
   - Check an unbounded query: missing primary bounds should serialize as null. 
Verify that descriptions distinguish an inclusive start from an exclusive end.
   
   Validation: all changed-file `uvx pre-commit run --files ...` hooks passed, 
including mypy and pylint. Targeted unit tests are in progress. A live-server 
check was unavailable because no service was listening on localhost:8088.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [x] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   Additive response fields only; no database migration or date-parser changes.
   


-- 
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]

Reply via email to