Skip to content

Commit

Permalink
fix(query): fix copy into table with diable distributed copy into
Browse files Browse the repository at this point in the history
  • Loading branch information
zhang2014 committed Sep 26, 2024
1 parent 7e14ac0 commit 4a828fb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/query/sql/src/executor/physical_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,6 @@ impl PhysicalPlan {
| PhysicalPlan::CacheScan(_)
| PhysicalPlan::ExchangeSource(_)
| PhysicalPlan::CompactSource(_)
| PhysicalPlan::CopyIntoTable(_)
| PhysicalPlan::ReplaceAsyncSourcer(_)
| PhysicalPlan::Recluster(_)
| PhysicalPlan::RecursiveCteScan(_) => Box::new(std::iter::empty()),
Expand Down Expand Up @@ -652,6 +651,10 @@ impl PhysicalPlan {
PhysicalPlan::ChunkAppendData(plan) => Box::new(std::iter::once(plan.input.as_ref())),
PhysicalPlan::ChunkMerge(plan) => Box::new(std::iter::once(plan.input.as_ref())),
PhysicalPlan::ChunkCommitInsert(plan) => Box::new(std::iter::once(plan.input.as_ref())),
PhysicalPlan::CopyIntoTable(v) => match &v.source {
CopyIntoTableSource::Query(v) => Box::new(std::iter::once(v.as_ref())),
CopyIntoTableSource::Stage(v) => Box::new(std::iter::once(v.as_ref())),
},
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
statement ok
DROP STAGE IF EXISTS stage_t4;

statement ok
DROP TABLE IF EXISTS t4;

statement ok
CREATE STAGE stage_t4;

statement ok
CREATE TABLE t4(str string);

statement ok
set enable_distributed_copy_into = 0;

statement ok
copy into @stage_t4 from (SELECT to_string(number) as str from numbers(10));

statement ok
INSERT INTO t1 (id, s) VALUES-- line comment

statement ok
COPY INTO t4 from @stage_t4 pattern='.*' FILE_FORMAT = (TYPE = 'parquet') PURGE=true FORCE=true max_files=10000;

statement ok
DROP STAGE IF EXISTS stage_t4;

statement ok
DROP TABLE IF EXISTS t4;

0 comments on commit 4a828fb

Please sign in to comment.