Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
modity test cases according to the sqlglot change
Signed-off-by: jaogoy <jaogoy@gmail.com>
  • Loading branch information
jaogoy committed Jan 28, 2026
commit d79dc21b8be76b02c5c7f712a47d506279d217f5
19 changes: 10 additions & 9 deletions tests/core/engine_adapter/test_starrocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,25 +806,26 @@ class TestPartitionPropertyBuilding:
"""Tests for partitioned_by/partition_by and partitions properties."""

@pytest.mark.parametrize(
"partition_expr,expected_clause",
"partition_expr,expected_clause,expected_clause2",
[
# Expression partitioning - single column
("'dt'", "PARTITION BY (`dt`)"),
("'dt'", "PARTITION BY `dt`", "PARTITION BY (`dt`)"),
# Expression partitioning - multi-column
("(year, month)", "PARTITION BY (`year`, `month`)"),
("(year, month)", "PARTITION BY `year`, `month`", "PARTITION BY (`year`, `month`)"),
# Expression partitioning - multi-column with func
("(date_trunc('day', dt), region)", "PARTITION BY DATE_TRUNC('DAY', `dt`), `region`"),
("(date_trunc('day', dt), region)", "PARTITION BY DATE_TRUNC('DAY', `dt`), `region`", None),
# RANGE partitioning
("RANGE (dt)", "PARTITION BY RANGE (`dt`) ()"),
("RANGE (dt)", "PARTITION BY RANGE (`dt`) ()", None),
# LIST partitioning
("LIST (region)", "PARTITION BY LIST (`region`) ()"),
("LIST (region)", "PARTITION BY LIST (`region`) ()", None),
],
)
def test_partitioned_by_forms(
self,
make_mocked_engine_adapter: t.Callable[..., StarRocksEngineAdapter],
partition_expr: str,
expected_clause: str,
expected_clause2: t.Optional[str],
):
"""Test partition_by with various forms parsed from physical_properties."""
model_sql = f"""
Expand Down Expand Up @@ -852,7 +853,7 @@ def test_partitioned_by_forms(
)

sql = to_sql_calls(adapter)[0]
assert expected_clause in sql
assert expected_clause in sql or expected_clause2 and expected_clause2 in sql

@pytest.mark.parametrize(
"partition_expr,expected_clause",
Expand Down Expand Up @@ -938,7 +939,7 @@ def test_partition_by_alias(
)

sql = to_sql_calls(adapter)[0]
assert "PARTITION BY (year, month)" in sql or "PARTITION BY (`year`, `month`)" in sql
assert "PARTITION BY (`year`, `month`)" in sql or "PARTITION BY `year`, `month`" in sql

def test_partitioned_by_as_model_parameter(
self, make_mocked_engine_adapter: t.Callable[..., StarRocksEngineAdapter]
Expand Down Expand Up @@ -966,7 +967,7 @@ def test_partitioned_by_as_model_parameter(
)

sql = to_sql_calls(adapter)[0]
assert "PARTITION BY (year, month)" in sql or "PARTITION BY (`year`, `month`)" in sql
assert "PARTITION BY (year, month)" in sql or "PARTITION BY `year`, `month`" in sql or "PARTITION BY (`year`, `month`)" in sql

def test_partitions_value_forms(
self, make_mocked_engine_adapter: t.Callable[..., StarRocksEngineAdapter]
Expand Down