refactor: refine timestamp expr function (#21510)

This commit is contained in:
Yongjie Zhao
2022-09-20 18:51:01 +08:00
committed by GitHub
parent 42000823be
commit 737d4dcf0c
4 changed files with 6 additions and 9 deletions

View File

@@ -77,8 +77,9 @@ class TestBigQueryDbEngineSpec(TestDbEngineSpec):
"TIMESTAMP": "TIMESTAMP_TRUNC(temporal, HOUR)",
}
for type_, expected in test_cases.items():
col.type = type_
actual = BigQueryEngineSpec.get_timestamp_expr(
col=col, pdf=None, time_grain="PT1H", type_=type_
col=col, pdf=None, time_grain="PT1H"
)
self.assertEqual(str(actual), expected)
@@ -99,8 +100,9 @@ class TestBigQueryDbEngineSpec(TestDbEngineSpec):
") AS TIMESTAMP)",
}
for type_, expected in test_cases.items():
col.type = type_
actual = BigQueryEngineSpec.get_timestamp_expr(
col=col, pdf=None, time_grain="PT5M", type_=type_
col=col, pdf=None, time_grain="PT5M"
)
assert str(actual) == expected