chore(druid): Standardizing time grain transformations (#17050)

* chore(druid): Standardizing time grain transformations

* Update druid_tests.py

* Update druid_tests.py

Co-authored-by: John Bodley <john.bodley@airbnb.com>
This commit is contained in:
John Bodley
2021-10-12 08:34:28 -07:00
committed by GitHub
parent c2e1ab6550
commit 5e85f48515
2 changed files with 13 additions and 11 deletions

View File

@@ -50,8 +50,10 @@ class TestDruidDbEngineSpec(TestDbEngineSpec):
col = "__time"
sqla_col = column(col)
test_cases = {
"PT1S": f"FLOOR({col} TO SECOND)",
"PT1S": f"TIME_FLOOR({col}, 'PT1S')",
"PT5M": f"TIME_FLOOR({col}, 'PT5M')",
"P1W/1970-01-03T00:00:00Z": f"TIME_SHIFT(TIME_FLOOR(TIME_SHIFT({col}, 'P1D', 1), 'P1W'), 'P1D', 5)",
"1969-12-28T00:00:00Z/P1W": f"TIME_SHIFT(TIME_FLOOR(TIME_SHIFT({col}, 'P1D', 1), 'P1W'), 'P1D', -1)",
}
for grain, expected in test_cases.items():
actual = DruidEngineSpec.get_timestamp_expr(