michael-s-molina commented on code in PR #24035: URL: https://github.com/apache/superset/pull/24035#discussion_r1192222394
########## tests/integration_tests/charts/data/api_tests.py: ########## @@ -1159,6 +1159,31 @@ def test_custom_cache_timeout(test_client, login_as_admin, physical_query_contex assert rv.json["result"][0]["cache_timeout"] == 5678 +def test_time_filter_with_grain(test_client, login_as_admin, physical_query_context): + physical_query_context["queries"][0]["filters"] = [ + { + "col": "col5", + "op": "TEMPORAL_RANGE", + "val": "Last quarter : ", + "grain": "P1W", + }, + ] + rv = test_client.post(CHART_DATA_URI, json=physical_query_context) + query = rv.json["result"][0]["query"] + backend = get_example_database().backend + if backend == "sqlite": + assert ( + "DATETIME(col5, 'start of day', -strftime('%w', col5) || ' days') >=" + in query + ) + elif backend == "mysql": + assert "DATE(DATE_SUB(col5, INTERVAL DAYOFWEEK(col5) - 1 DAY)) >=" in query + elif backend == "postgresql": + assert "DATE_TRUNC('week', col5) >=" in query + elif backend == "postgresql": Review Comment: Duplicated `postgresql` -- 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: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org