Skip to content
Open
Show file tree
Hide file tree
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
modify code according some small change of sqlglot
Signed-off-by: jaogoy <jaogoy@gmail.com>
  • Loading branch information
jaogoy committed Feb 5, 2026
commit 03907762f10bbc13efbeabbf7fb908bd8ee4e1d5
7 changes: 3 additions & 4 deletions sqlmesh/core/engine_adapter/starrocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2882,7 +2882,7 @@ def _build_partitioned_by_exp(
create_expressions=create_expressions,
)
elif partition_kind is None:
return exp.PartitionedByProperty(this=exp.tuple_(*partitioned_by))
return exp.PartitionedByProperty(this=exp.Schema(expressions=partitioned_by))

return None

Expand Down Expand Up @@ -2947,13 +2947,12 @@ def _build_distributed_by_property(
expressions_list.append(exp.to_column(str(col)))
# Build buckets expression
buckets: t.Optional[t.Any] = unified.get("buckets")
buckets_expr: t.Optional[exp.Expression] = None
if buckets is not None:
if isinstance(buckets, exp.Literal):
buckets_expr = buckets
else:
buckets_expr = exp.Literal.number(int(buckets))
else:
buckets_expr = None

result = exp.DistributedByProperty(
kind=kind_expr,
Expand Down Expand Up @@ -2986,7 +2985,7 @@ def _build_refresh_property(
# method is required by exp.RefreshTriggerProperty, but StarRocks syntax does NOT support AUTO.
# We use a sentinel value that the StarRocks generator will not render (it only renders
# IMMEDIATE/DEFERRED).
method_expr = exp.Var(this="UNSPECIFIED")
method_expr = None
if refresh_moment is not None:
refresh_moment_text = PropertyValidator.validate_and_normalize_property(
"refresh_moment", refresh_moment
Expand Down
12 changes: 10 additions & 2 deletions tests/core/engine_adapter/test_starrocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,11 @@ class TestPartitionPropertyBuilding:
# Expression partitioning - multi-column
("(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`", None),
(
"(date_trunc('day', dt), region)",
"PARTITION BY DATE_TRUNC('DAY', `dt`), `region`",
None,
),
# RANGE partitioning
("RANGE (dt)", "PARTITION BY RANGE (`dt`) ()", None),
# LIST partitioning
Expand Down Expand Up @@ -967,7 +971,11 @@ 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 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