-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support scan empty projection #7920
Changes from all commits
4d33a9c
6308904
7828f39
7049c62
6302fd5
53c04f6
2db2885
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ use crate::{ | |
|
||
use arrow::datatypes::{Fields, Schema, SchemaRef}; | ||
use arrow::record_batch::RecordBatch; | ||
use arrow_array::RecordBatchOptions; | ||
use datafusion_common::stats::Precision; | ||
use datafusion_common::{plan_err, DataFusionError, Result, ScalarValue}; | ||
use datafusion_execution::memory_pool::{MemoryConsumer, MemoryReservation}; | ||
|
@@ -347,13 +348,14 @@ fn build_batch( | |
}) | ||
.collect::<Result<Vec<_>>>()?; | ||
|
||
RecordBatch::try_new( | ||
RecordBatch::try_new_with_options( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we have more operators with empty inputs that use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have thought about this too, but I didn't come up with any more tests😥. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is fine to merge as is and see if we get any regressions (hopefully not), those should be easy to fix in a similar manner. |
||
Arc::new(schema.clone()), | ||
arrays | ||
.iter() | ||
.chain(batch.columns().iter()) | ||
.cloned() | ||
.collect(), | ||
&RecordBatchOptions::new().with_row_count(Some(batch.num_rows())), | ||
) | ||
.map_err(Into::into) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -695,7 +695,7 @@ logical_plan | |
Projection: __scalar_sq_1.COUNT(*) AS b | ||
--SubqueryAlias: __scalar_sq_1 | ||
----Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]] | ||
------TableScan: t1 projection=[t1_id] | ||
------TableScan: t1 projection=[] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎉 |
||
|
||
#simple_uncorrelated_scalar_subquery2 | ||
query TT | ||
|
@@ -706,10 +706,10 @@ Projection: __scalar_sq_1.COUNT(*) AS b, __scalar_sq_2.COUNT(Int64(1)) AS COUNT( | |
--Left Join: | ||
----SubqueryAlias: __scalar_sq_1 | ||
------Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]] | ||
--------TableScan: t1 projection=[t1_id] | ||
--------TableScan: t1 projection=[] | ||
----SubqueryAlias: __scalar_sq_2 | ||
------Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1))]] | ||
--------TableScan: t2 projection=[t2_id] | ||
--------TableScan: t2 projection=[] | ||
|
||
query II | ||
select (select count(*) from t1) as b, (select count(1) from t2) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can remove the [
LogicalPlan::Values
] case as well (https://github.com/apache/arrow-datafusion/pull/7920/files#diff-96a0620f2e490af5e30f17cfb0b6a0070fd99656dd4957966693894c816abe0bL166-L175)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, we can remove it.already fix, thanks.