diff --git a/metricflow/sql/render/big_query.py b/metricflow/sql/render/big_query.py index bef39e99f..0f1f989db 100644 --- a/metricflow/sql/render/big_query.py +++ b/metricflow/sql/render/big_query.py @@ -167,7 +167,7 @@ def visit_extract_expr(self, node: SqlExtractExpression) -> SqlExpressionRenderR ) @override - def visit_time_delta_expr(self, node: SqlSubtractTimeIntervalExpression) -> SqlExpressionRenderResult: + def visit_subtract_time_interval_expr(self, node: SqlSubtractTimeIntervalExpression) -> SqlExpressionRenderResult: """Render time delta for BigQuery, which requires ISO prefixing for the WEEK granularity value.""" column = node.arg.accept(self) diff --git a/metricflow/sql/render/duckdb_renderer.py b/metricflow/sql/render/duckdb_renderer.py index 6ff7fb9e7..ed69b980f 100644 --- a/metricflow/sql/render/duckdb_renderer.py +++ b/metricflow/sql/render/duckdb_renderer.py @@ -37,7 +37,7 @@ def supported_percentile_function_types(self) -> Collection[SqlPercentileFunctio } @override - def visit_time_delta_expr(self, node: SqlSubtractTimeIntervalExpression) -> SqlExpressionRenderResult: + def visit_subtract_time_interval_expr(self, node: SqlSubtractTimeIntervalExpression) -> SqlExpressionRenderResult: """Render time delta expression for DuckDB, which requires slightly different syntax from other engines.""" arg_rendered = node.arg.accept(self) diff --git a/metricflow/sql/render/expr_renderer.py b/metricflow/sql/render/expr_renderer.py index 0fd9e81e8..f7e3fcf75 100644 --- a/metricflow/sql/render/expr_renderer.py +++ b/metricflow/sql/render/expr_renderer.py @@ -303,7 +303,9 @@ def render_date_part(self, date_part: DatePart) -> str: return date_part.value - def visit_time_delta_expr(self, node: SqlSubtractTimeIntervalExpression) -> SqlExpressionRenderResult: # noqa: D102 + def visit_subtract_time_interval_expr( + self, node: SqlSubtractTimeIntervalExpression + ) -> SqlExpressionRenderResult: # noqa: D102 arg_rendered = node.arg.accept(self) count = node.count diff --git a/metricflow/sql/render/postgres.py b/metricflow/sql/render/postgres.py index 36a1b687e..121622c56 100644 --- a/metricflow/sql/render/postgres.py +++ b/metricflow/sql/render/postgres.py @@ -40,7 +40,7 @@ def supported_percentile_function_types(self) -> Collection[SqlPercentileFunctio return {SqlPercentileFunctionType.CONTINUOUS, SqlPercentileFunctionType.DISCRETE} @override - def visit_time_delta_expr(self, node: SqlSubtractTimeIntervalExpression) -> SqlExpressionRenderResult: + def visit_subtract_time_interval_expr(self, node: SqlSubtractTimeIntervalExpression) -> SqlExpressionRenderResult: """Render time delta operations for PostgreSQL, which needs custom support for quarterly granularity.""" arg_rendered = node.arg.accept(self) diff --git a/metricflow/sql/render/trino.py b/metricflow/sql/render/trino.py index 23bd65ab6..155fb6e46 100644 --- a/metricflow/sql/render/trino.py +++ b/metricflow/sql/render/trino.py @@ -45,7 +45,7 @@ def visit_generate_uuid_expr(self, node: SqlGenerateUuidExpression) -> SqlExpres ) @override - def visit_time_delta_expr(self, node: SqlSubtractTimeIntervalExpression) -> SqlExpressionRenderResult: + def visit_subtract_time_interval_expr(self, node: SqlSubtractTimeIntervalExpression) -> SqlExpressionRenderResult: """Render time delta for Trino, require granularity in quotes and function name change.""" arg_rendered = node.arg.accept(self) diff --git a/metricflow/sql/sql_exprs.py b/metricflow/sql/sql_exprs.py index 62d8e9687..16671de04 100644 --- a/metricflow/sql/sql_exprs.py +++ b/metricflow/sql/sql_exprs.py @@ -210,7 +210,9 @@ def visit_extract_expr(self, node: SqlExtractExpression) -> VisitorOutputT: # n pass @abstractmethod - def visit_time_delta_expr(self, node: SqlSubtractTimeIntervalExpression) -> VisitorOutputT: # noqa: D102 + def visit_subtract_time_interval_expr( + self, node: SqlSubtractTimeIntervalExpression + ) -> VisitorOutputT: # noqa: D102 pass @abstractmethod @@ -1285,11 +1287,11 @@ def requires_parenthesis(self) -> bool: # noqa: D102 return False def accept(self, visitor: SqlExpressionNodeVisitor[VisitorOutputT]) -> VisitorOutputT: # noqa: D102 - return visitor.visit_time_delta_expr(self) + return visitor.visit_subtract_time_interval_expr(self) @property def description(self) -> str: # noqa: D102 - return "Time delta" + return "Subtract time interval" def rewrite( # noqa: D102 self,