mikebridge commented on code in PR #44263:
URL: https://github.com/apache/superset/pull/44263#discussion_r4043512613


##########
tests/unit_tests/common/test_tabular_query.py:
##########
@@ -424,3 +425,76 @@ def test_one_sided_bound_uses_a_space_separator() -> None:
     )["filters"]
 
     assert "T" not in clause["val"]
+
+
+def _resolved_get_table_query_object(time_range: str) -> QueryObject:
+    """Model the semantic-view get_table query object at cache-key time.
+
+    ``build_query_dict`` (the get_table builder) expresses the range only as a
+    ``TEMPORAL_RANGE`` filter — it never sets ``time_range`` — and
+    ``QueryContextFactory`` then resolves that filter to ``from_dttm``/
+    ``to_dttm`` and ``_apply_granularity`` drops the granularity-column filter
+    before the cache key is taken. This reproduces that resolved state: no
+    ``time_range`` attribute, temporal filter removed, bounds resolved.
+    """
+    from superset.common.utils.time_range_utils import 
get_since_until_from_time_range
+
+    query_dict = build_query_dict(
+        time_column="metric_time",
+        metrics=["revenue"],
+        dimensions=["metric_time"],
+        filters=[{"col": "product__product_name", "op": "==", "val": 
"mel-bun"}],
+        time_range=time_range,
+        rewrite_one_sided_time_range=True,  # the view path

Review Comment:
   Agreed — `rewrite_one_sided_time_range=True` is inert for a two-sided range 
and the one-sided view ranges never collided with `_apply_granularity`; leaving 
the test as is. Thanks for the trace.



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