You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "john-bodley (via GitHub)" <gi...@apache.org> on 2023/08/10 16:59:13 UTC
[GitHub] [superset] john-bodley commented on a diff in pull request #24942: fix(pinot): The `python_date_format` for a temporal column was not being passed to `get_timestamp_expr`
john-bodley commented on code in PR #24942:
URL: https://github.com/apache/superset/pull/24942#discussion_r1290426308
##########
superset/connectors/sqla/models.py:
##########
@@ -990,7 +990,9 @@ def adhoc_column_to_sqla( # pylint: disable=too-many-locals
time_grain = col.get("timeGrain")
has_timegrain = col.get("columnType") == "BASE_AXIS" and time_grain
is_dttm = False
+ pdf = None
if col_in_metadata := self.get_column(expression):
+ pdf = col_in_metadata.python_date_format
Review Comment:
Given that you're changing how the Python date format logic is used, would you mind adding a unit test for this.
##########
superset/db_engine_specs/pinot.py:
##########
@@ -99,12 +101,13 @@ def get_timestamp_expr(
else:
seconds_or_ms = "MILLISECONDS" if pdf == "epoch_ms" else "SECONDS"
tf = f"1:{seconds_or_ms}:EPOCH"
+
if time_grain:
granularity = cls.get_time_grain_expressions().get(time_grain)
if not granularity:
raise NotImplementedError(f"No pinot grain spec for '{time_grain}'")
else:
- return TimestampExpression("{{col}}", col)
+ return TimestampExpression("{col}", col)
Review Comment:
Would you also mind adding some unit tests for Pinot which cover the `get_timestamp_expr` function. You can find many other examples of this in the other DB engine specs.
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org