Skip to content

Commit

Permalink
Fix copy/paste errors on sql expr IDs
Browse files Browse the repository at this point in the history
We had a couple of copy/paste issues with sql expression nodes
identifying themselves as IS_NULL expressions. This tidies that up.
  • Loading branch information
tlento committed Oct 5, 2023
1 parent 2fdc42a commit c7b37c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions metricflow/dag/id_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
SQL_EXPR_IS_NULL_PREFIX = "isn"
SQL_EXPR_CAST_TO_TIMESTAMP_PREFIX = "ctt"
SQL_EXPR_DATE_TRUNC = "dt"
SQL_EXPR_SUBTRACT_TIME_INTERVAL_PREFIX = "sti"
SQL_EXPR_EXTRACT = "ex"
SQL_EXPR_RATIO_COMPUTATION = "rc"
SQL_EXPR_BETWEEN_PREFIX = "betw"
Expand Down
6 changes: 4 additions & 2 deletions metricflow/sql/sql_exprs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from metricflow.dag.id_generation import (
SQL_EXPR_BETWEEN_PREFIX,
SQL_EXPR_CAST_TO_TIMESTAMP_PREFIX,
SQL_EXPR_COLUMN_REFERENCE_ID_PREFIX,
SQL_EXPR_COMPARISON_ID_PREFIX,
SQL_EXPR_DATE_TRUNC,
Expand All @@ -29,6 +30,7 @@
SQL_EXPR_RATIO_COMPUTATION,
SQL_EXPR_STRING_ID_PREFIX,
SQL_EXPR_STRING_LITERAL_PREFIX,
SQL_EXPR_SUBTRACT_TIME_INTERVAL_PREFIX,
SQL_EXPR_WINDOW_FUNCTION_ID_PREFIX,
)
from metricflow.dag.mf_dag import DagNode, DisplayedProperty, NodeId
Expand Down Expand Up @@ -1265,7 +1267,7 @@ def __init__( # noqa: D

@classmethod
def id_prefix(cls) -> str: # noqa: D
return SQL_EXPR_IS_NULL_PREFIX
return SQL_EXPR_SUBTRACT_TIME_INTERVAL_PREFIX

@property
def requires_parenthesis(self) -> bool: # noqa: D
Expand Down Expand Up @@ -1321,7 +1323,7 @@ def __init__(self, arg: SqlExpressionNode) -> None: # noqa: D

@classmethod
def id_prefix(cls) -> str: # noqa: D
return SQL_EXPR_IS_NULL_PREFIX
return SQL_EXPR_CAST_TO_TIMESTAMP_PREFIX

@property
def requires_parenthesis(self) -> bool: # noqa: D
Expand Down

0 comments on commit c7b37c4

Please sign in to comment.