You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2022/04/14 18:17:36 UTC

[superset] branch add-time-grains-pinot updated: update test

This is an automated email from the ASF dual-hosted git repository.

hugh pushed a commit to branch add-time-grains-pinot
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/add-time-grains-pinot by this push:
     new 4f943992eb update test
4f943992eb is described below

commit 4f943992eb8ae24a387b1850204597516ab56715
Author: hughhhh <hu...@gmail.com>
AuthorDate: Thu Apr 14 14:17:18 2022 -0400

    update test
---
 superset/db_engine_specs/pinot.py                      |  4 ++++
 tests/integration_tests/db_engine_specs/pinot_tests.py | 13 +++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/superset/db_engine_specs/pinot.py b/superset/db_engine_specs/pinot.py
index 1b384ac9b7..38e30accec 100644
--- a/superset/db_engine_specs/pinot.py
+++ b/superset/db_engine_specs/pinot.py
@@ -57,6 +57,10 @@ class PinotEngineSpec(BaseEngineSpec):  # pylint: disable=abstract-method
     _use_date_trunc_function: Dict[str, bool] = {
         "PT1S": False,
         "PT1M": False,
+        "PT5M": False,
+        "PT10M": False,
+        "PT15M": False,
+        "PT30M": False,
         "PT1H": False,
         "P1D": False,
         "P1W": True,
diff --git a/tests/integration_tests/db_engine_specs/pinot_tests.py b/tests/integration_tests/db_engine_specs/pinot_tests.py
index 803dd67cba..c6e364a8ea 100644
--- a/tests/integration_tests/db_engine_specs/pinot_tests.py
+++ b/tests/integration_tests/db_engine_specs/pinot_tests.py
@@ -45,6 +45,19 @@ class TestPinotDbEngineSpec(TestDbEngineSpec):
             ),
         )
 
+    def test_pinot_time_expression_simple_date_format_10m_grain(self):
+        col = column("tstamp")
+        expr = PinotEngineSpec.get_timestamp_expr(col, "%Y-%m-%d %H:%M:%S", "PT10M")
+        result = str(expr.compile())
+        self.assertEqual(
+            result,
+            (
+                "DATETIMECONVERT(tstamp, "
+                + "'1:SECONDS:SIMPLE_DATE_FORMAT:yyyy-MM-dd HH:mm:ss', "
+                + "'1:SECONDS:SIMPLE_DATE_FORMAT:yyyy-MM-dd HH:mm:ss', '10:MINUTES')"
+            ),
+        )
+
     def test_pinot_time_expression_simple_date_format_1w_grain(self):
         col = column("tstamp")
         expr = PinotEngineSpec.get_timestamp_expr(col, "%Y-%m-%d %H:%M:%S", "P1W")