@@ -806,25 +806,26 @@ class TestPartitionPropertyBuilding:
806806 """Tests for partitioned_by/partition_by and partitions properties."""
807807
808808 @pytest .mark .parametrize (
809- "partition_expr,expected_clause" ,
809+ "partition_expr,expected_clause,expected_clause2 " ,
810810 [
811811 # Expression partitioning - single column
812- ("'dt'" , "PARTITION BY (`dt`)" ),
812+ ("'dt'" , "PARTITION BY `dt`" , "PARTITION BY (`dt`)" ),
813813 # Expression partitioning - multi-column
814- ("(year, month)" , "PARTITION BY (`year`, `month`)" ),
814+ ("(year, month)" , "PARTITION BY `year`, `month`" , "PARTITION BY (`year`, `month`)" ),
815815 # Expression partitioning - multi-column with func
816- ("(date_trunc('day', dt), region)" , "PARTITION BY DATE_TRUNC('DAY', `dt`), `region`" ),
816+ ("(date_trunc('day', dt), region)" , "PARTITION BY DATE_TRUNC('DAY', `dt`), `region`" , None ),
817817 # RANGE partitioning
818- ("RANGE (dt)" , "PARTITION BY RANGE (`dt`) ()" ),
818+ ("RANGE (dt)" , "PARTITION BY RANGE (`dt`) ()" , None ),
819819 # LIST partitioning
820- ("LIST (region)" , "PARTITION BY LIST (`region`) ()" ),
820+ ("LIST (region)" , "PARTITION BY LIST (`region`) ()" , None ),
821821 ],
822822 )
823823 def test_partitioned_by_forms (
824824 self ,
825825 make_mocked_engine_adapter : t .Callable [..., StarRocksEngineAdapter ],
826826 partition_expr : str ,
827827 expected_clause : str ,
828+ expected_clause2 : t .Optional [str ],
828829 ):
829830 """Test partition_by with various forms parsed from physical_properties."""
830831 model_sql = f"""
@@ -852,7 +853,7 @@ def test_partitioned_by_forms(
852853 )
853854
854855 sql = to_sql_calls (adapter )[0 ]
855- assert expected_clause in sql
856+ assert expected_clause in sql or expected_clause2 and expected_clause2 in sql
856857
857858 @pytest .mark .parametrize (
858859 "partition_expr,expected_clause" ,
@@ -938,7 +939,7 @@ def test_partition_by_alias(
938939 )
939940
940941 sql = to_sql_calls (adapter )[0 ]
941- assert "PARTITION BY (year, month)" in sql or "PARTITION BY ( `year`, `month`) " in sql
942+ assert "PARTITION BY (` year`, ` month` )" in sql or "PARTITION BY `year`, `month`" in sql
942943
943944 def test_partitioned_by_as_model_parameter (
944945 self , make_mocked_engine_adapter : t .Callable [..., StarRocksEngineAdapter ]
@@ -966,7 +967,7 @@ def test_partitioned_by_as_model_parameter(
966967 )
967968
968969 sql = to_sql_calls (adapter )[0 ]
969- assert "PARTITION BY (year, month)" in sql or "PARTITION BY (`year`, `month`)" in sql
970+ assert "PARTITION BY (year, month)" in sql or "PARTITION BY `year`, `month`" in sql or "PARTITION BY (`year`, `month`)" in sql
970971
971972 def test_partitions_value_forms (
972973 self , make_mocked_engine_adapter : t .Callable [..., StarRocksEngineAdapter ]
0 commit comments