Skip to content

Commit 12a6773

Browse files
committed
fix(query): avoid downcasting non-Fuse write targets
1 parent 57a3f90 commit 12a6773

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/query/ast/tests/it/testdata/stmt-error.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ error:
9696
1 | create table a (c1 decimal(38), c2 int) partition by ();
9797
| ------ ^
9898
| | |
99-
| | expecting `<LiteralString>`, '<LiteralCodeString>', '<LiteralInteger>', '<LiteralFloat>', 'TRUE', 'FALSE', or more ...
99+
| | unexpected `)`, expecting <Ident>, <LiteralString>, `IDENTIFIER`, <LiteralCodeString>, <LiteralInteger>, <LiteralFloat>, <MySQLLiteralHex>, <PGLiteralHex>, `TRUE`, `FALSE`, or `NULL`
100100
| | while parsing expression
101101
| while parsing `CREATE [OR REPLACE] TABLE [IF NOT EXISTS] [<database>.]<table> [<source>] [<table_options>]`
102102

src/query/service/src/interpreters/interpreter_insert.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,10 @@ impl InsertInterpreter {
312312
metadata: &MetadataRef,
313313
cast_needed: bool,
314314
) -> Result<(PhysicalPlan, bool)> {
315-
let Ok(fuse_table) = FuseTable::try_from_table(table.as_ref()) else {
315+
if table.engine() != "FUSE" {
316316
return Ok((input, false));
317-
};
317+
}
318+
let fuse_table = FuseTable::try_from_table(table.as_ref())?;
318319
if !fuse_table.use_hash_write_distribution() {
319320
return Ok((input, false));
320321
}

src/query/service/src/pipelines/builders/builder_append_table.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ impl PipelineBuilder {
4545
pipeline: &mut Pipeline,
4646
table: Arc<dyn Table>,
4747
) -> Result<()> {
48-
let Ok(fuse_table) = FuseTable::try_from_table(table.as_ref()) else {
48+
if table.engine() != "FUSE" {
4949
return Ok(());
50-
};
50+
}
51+
let fuse_table = FuseTable::try_from_table(table.as_ref())?;
5152
if !fuse_table.use_hash_write_distribution() {
5253
return Ok(());
5354
}

0 commit comments

Comments
 (0)