Skip to content

Commit

Permalink
fix: ignore_result doesn't have an effect on union (#16515)
Browse files Browse the repository at this point in the history
fix: ignore_result does not have an effect on union
  • Loading branch information
xudong963 authored Sep 25, 2024
1 parent 9c4735a commit 9b4b024
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/query/service/src/schedulers/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ use std::sync::Arc;
use async_trait::async_trait;
use databend_common_exception::Result;
use databend_common_expression::DataBlock;
use databend_common_pipeline_core::processors::ProcessorPtr;
use databend_common_pipeline_sinks::EmptySink;
use databend_common_sql::optimizer::QuerySampleExecutor;
use futures_util::TryStreamExt;

Expand Down Expand Up @@ -46,6 +48,11 @@ pub async fn build_query_pipeline(
if matches!(plan, PhysicalPlan::UnionAll { .. }) {
// Union doesn't need to add extra processor to project the result.
// It will be handled in union processor.
if ignore_result {
build_res
.main_pipeline
.add_sink(|input| Ok(ProcessorPtr::create(EmptySink::create(input))))?;
}
return Ok(build_res);
}
let input_schema = plan.output_schema()?;
Expand Down
5 changes: 5 additions & 0 deletions tests/sqllogictests/suites/query/union.test
Original file line number Diff line number Diff line change
Expand Up @@ -318,3 +318,8 @@ SELECT COUNT(1), 'numbers(10)' FROM numbers(10)

statement ok
unset max_set_operator_count;

query I
select * from numbers(100) union all select * from numbers(100) ignore_result;
----

0 comments on commit 9b4b024

Please sign in to comment.