@@ -1446,6 +1446,35 @@ def test_sushi(ctx: TestContext, tmp_path_factory: pytest.TempPathFactory):
14461446 f"CREATE VIEW { raw_test_schema } .demographics ON CLUSTER cluster1 AS SELECT 1 AS customer_id, '00000' AS zip;"
14471447 )
14481448
1449+ # DuckDB parses TIMESTAMP into Type.TIMESTAMPNTZ which generates into TIMESTAMP_NTZ for
1450+ # Spark, but this type is not supported in Spark's DDL statements so we make it a TIMESTAMP
1451+ if ctx .dialect == "spark" :
1452+ for model_key , model in context ._models .items ():
1453+ model_columns = model .columns_to_types
1454+
1455+ updated_model_columns = {}
1456+ for k , v in model_columns .items ():
1457+ updated_model_columns [k ] = v
1458+ if v .this == exp .DataType .Type .TIMESTAMPNTZ :
1459+ v .set ("this" , exp .DataType .Type .TIMESTAMP )
1460+
1461+ update_fields = {
1462+ "columns_to_types" : updated_model_columns ,
1463+ "columns_to_types_" : updated_model_columns ,
1464+ "columns_to_types_or_raise" : updated_model_columns ,
1465+ }
1466+
1467+ # We get rid of the sushi.marketing post statement here because it asserts that
1468+ # updated_at is a 'timestamp', which is parsed using duckdb in assert_has_columns
1469+ # and the assertion fails because we now have TIMESTAMPs and not TIMESTAMPNTZs in
1470+ # the columns_to_types mapping
1471+ if '"marketing"' in model_key :
1472+ update_fields ["post_statements_" ] = []
1473+
1474+ context ._models .update (
1475+ {model_key : context ._models [model_key ].copy (update = update_fields )}
1476+ )
1477+
14491478 if ctx .dialect == "athena" :
14501479 for model_name in {"customer_revenue_lifetime" }:
14511480 model_key = next (k for k in context ._models if model_name in k )
0 commit comments