Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions datafusion/core/src/physical_planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,16 +654,12 @@ impl DefaultPhysicalPlanner {
let physical_input_schema = input_exec.schema();
let logical_input_schema = input.as_ref().schema();
let physical_input_schema_from_logical = logical_input_schema.inner();
// If the physical input schema has only one field and the logical input schema has no fields, we skip the schema check
// This is because the physical plan may add a dummy column to the input schema to represent the row,
// e.g. with test AS (SELECT i as v FROM generate_series(1, 10) t(i)) select count(1) from test WHERE 1 = 1;
if !(options.execution.skip_physical_aggregate_schema_check
|| schema_satisfied_by(

if !options.execution.skip_physical_aggregate_schema_check
&& !schema_satisfied_by(
physical_input_schema_from_logical,
&physical_input_schema,
)
|| (physical_input_schema.fields().len() == 1
&& physical_input_schema_from_logical.fields().len() == 0))
{
let mut differences = Vec::new();
if physical_input_schema.fields().len()
Expand Down
9 changes: 6 additions & 3 deletions datafusion/functions-table/src/generate_series.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,15 @@ impl TableProvider for GenerateSeriesTable {
async fn scan(
&self,
state: &dyn Session,
_projection: Option<&Vec<usize>>,
projection: Option<&Vec<usize>>,
_filters: &[Expr],
_limit: Option<usize>,
) -> Result<Arc<dyn ExecutionPlan>> {
let batch_size = state.config_options().execution.batch_size;

let schema = match projection {
Some(projection) => Arc::new(self.schema.project(projection)?),
None => self.schema.clone()
};
let state = match self.args {
// if args have null, then return 0 row
GenSeriesArgs::ContainsNull { include_end, name } => GenerateSeriesState {
Expand Down Expand Up @@ -175,7 +178,7 @@ impl TableProvider for GenerateSeriesTable {
};

Ok(Arc::new(LazyMemoryExec::try_new(
self.schema(),
schema,
vec![Arc::new(RwLock::new(state))],
)?))
}
Expand Down