Skip to content

Commit aeb2cda

Browse files
committed
Fix: skip DataTypeParam when checking type inference (#2446)
* Fix: skip DataTypeParam when checking type inference * test * Fix test
1 parent 47ee12f commit aeb2cda

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

sqlmesh/utils/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ def check_expression_unknown(d_type: t.Union[exp.DataType, exp.ColumnDef]) -> bo
326326
if not d_type.kind:
327327
return False
328328
d_type = d_type.kind
329+
if isinstance(d_type, exp.DataTypeParam):
330+
return True
329331
if d_type.is_type(exp.DataType.Type.UNKNOWN, exp.DataType.Type.NULL):
330332
return False
331333
if d_type.expressions:

tests/utils/test_helpers.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pytest
22
from sqlglot import expressions
3+
from sqlglot.optimizer.annotate_types import annotate_types
34

45
from sqlmesh.utils import columns_to_types_all_known
56

@@ -63,6 +64,10 @@
6364
},
6465
False,
6566
),
67+
(
68+
{"a": annotate_types(expressions.DataType.build("VARCHAR(MAX)", dialect="redshift"))},
69+
True,
70+
),
6671
],
6772
)
6873
def test_columns_to_types_all_known(columns_to_types, expected) -> None:

0 commit comments

Comments
 (0)