Skip to content

Commit fe814a8

Browse files
committed
fixup! Check the partition_by clause for MVs during planning
1 parent 8b57601 commit fe814a8

File tree

1 file changed

+4
-1
lines changed
  • src/sql/src/plan/statement

1 file changed

+4
-1
lines changed

src/sql/src/plan/statement/ddl.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ const MAX_NUM_COLUMNS: usize = 256;
176176
const MANAGED_REPLICA_PATTERN: std::sync::LazyLock<regex::Regex> =
177177
std::sync::LazyLock::new(|| regex::Regex::new(r"^r(\d)+$").unwrap());
178178

179+
/// Given a relation desc and a column list, checks that:
180+
/// - the column list is a prefix of the desc;
181+
/// - all the listed columns are types that have meaningful Persist-level ordering.
179182
fn check_partition_by(desc: &RelationDesc, partition_by: &[ColumnName]) -> Result<(), PlanError> {
180183
for (idx, ((desc_name, desc_type), partition_name)) in
181184
desc.iter().zip(partition_by.iter()).enumerate()
@@ -184,7 +187,7 @@ fn check_partition_by(desc: &RelationDesc, partition_by: &[ColumnName]) -> Resul
184187
sql_bail!("PARTITION BY columns should be a prefix of the relation's columns (expected {desc_name} at index {idx}, got {partition_name})");
185188
}
186189
if !preserves_order(&desc_type.scalar_type) {
187-
sql_bail!("PARTITION BY column {partition_name} has unsupported type",);
190+
sql_bail!("PARTITION BY column {partition_name} has unsupported type");
188191
}
189192
}
190193
Ok(())

0 commit comments

Comments
 (0)