Skip to content

Commit

Permalink
fix(pinot): typo in the name for epoch_ms_to_dttm (apache#26906)
Browse files Browse the repository at this point in the history
  • Loading branch information
ege-st authored Jan 31, 2024
1 parent 73d118c commit 484901f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion superset/db_engine_specs/pinot.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def epoch_to_dttm(cls) -> str:
)

@classmethod
def epoch_ms_to_dttm_(cls) -> str:
def epoch_ms_to_dttm(cls) -> str:
return (
"DATETIMECONVERT({col}, '1:MILLISECONDS:EPOCH', "
+ "'1:MILLISECONDS:EPOCH', '1:MILLISECONDS')"
Expand Down
14 changes: 14 additions & 0 deletions tests/integration_tests/db_engine_specs/pinot_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,20 @@ def test_pinot_time_expression_sec_one_1m_grain(self):
expected,
)

def test_pinot_time_expression_millisec_one_1m_grain(self):
col = column("tstamp")
expr = PinotEngineSpec.get_timestamp_expr(col, "epoch_ms", "P1M")
result = str(expr.compile())
expected = (
"CAST(DATE_TRUNC('month', CAST("
+ "DATETIMECONVERT(tstamp, '1:MILLISECONDS:EPOCH', "
+ "'1:MILLISECONDS:EPOCH', '1:MILLISECONDS') AS TIMESTAMP)) AS TIMESTAMP)"
)
self.assertEqual(
result,
expected,
)

def test_invalid_get_time_expression_arguments(self):
with self.assertRaises(NotImplementedError):
PinotEngineSpec.get_timestamp_expr(column("tstamp"), None, "P0.25Y")
Expand Down

0 comments on commit 484901f

Please sign in to comment.