Skip to content

Commit 8ba8f85

Browse files
committed
revert #6595
1 parent d37351a commit 8ba8f85

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed

datafusion/common/src/dfschema.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -384,12 +384,8 @@ impl DFSchema {
384384
let self_fields = self.fields().iter();
385385
let other_fields = other.fields().iter();
386386
self_fields.zip(other_fields).all(|(f1, f2)| {
387-
// TODO: resolve field when exist alias
388-
// f1.qualifier() == f2.qualifier()
389-
// && f1.name() == f2.name()
390-
// column(t1.a) field is "t1"."a"
391-
// column(x) as t1.a field is ""."t1.a"
392-
f1.qualified_name() == f2.qualified_name()
387+
f1.qualifier() == f2.qualifier()
388+
&& f1.name() == f2.name()
393389
&& Self::datatype_is_semantically_equal(f1.data_type(), f2.data_type())
394390
})
395391
}

datafusion/core/tests/sqllogictests/test_files/pg_compat/pg_compat_null.slt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ WITH HEADER ROW
7070
LOCATION '../../testing/data/csv/aggregate_test_100.csv'
7171

7272

73-
statement ok
73+
statement error DataFusion error: Error during planning: Mismatch between schema and batches
7474
CREATE TABLE aggregate_test_100_nullable_by_sql AS
7575
SELECT
7676
*,
@@ -82,15 +82,13 @@ SELECT
8282
WHEN c3 % 3 != 0 THEN c9
8383
ELSE NULL
8484
END AS n9
85-
FROM aggregate_test_100_by_sql
85+
FROM aggregate_test_100_by_sql;
8686

8787

88-
query III
88+
query error DataFusion error: Error during planning: table 'datafusion\.public\.aggregate_test_100_nullable_by_sql' not found
8989
SELECT
9090
COUNT(*), COUNT(n5), COUNT(n9)
9191
FROM aggregate_test_100_nullable_by_sql
92-
----
93-
100 66 72
9492

9593

9694
########
@@ -99,5 +97,5 @@ FROM aggregate_test_100_nullable_by_sql
9997
statement ok
10098
DROP TABLE aggregate_test_100_by_sql
10199

102-
statement ok
100+
statement error DataFusion error: Execution error: Table 'aggregate_test_100_nullable_by_sql' doesn't exist\.
103101
DROP TABLE aggregate_test_100_nullable_by_sql

datafusion/core/tests/sqllogictests/test_files/union.slt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,13 +432,13 @@ logical_plan
432432
Sort: t1.c1 ASC NULLS LAST
433433
--Union
434434
----TableScan: t1 projection=[c1]
435-
----Projection: t2.c1a AS c1
435+
----Projection: t2.c1a AS t1.c1
436436
------TableScan: t2 projection=[c1a]
437437
physical_plan
438438
SortPreservingMergeExec: [c1@0 ASC NULLS LAST]
439439
--UnionExec
440440
----CsvExec: file_groups={1 group: [[WORKSPACE_ROOT/testing/data/csv/aggregate_test_100.csv]]}, projection=[c1], output_ordering=[c1@0 ASC NULLS LAST], has_header=true
441-
----ProjectionExec: expr=[c1a@0 as c1]
441+
----ProjectionExec: expr=[c1a@0 as t1.c1]
442442
------CsvExec: file_groups={1 group: [[WORKSPACE_ROOT/testing/data/csv/aggregate_test_100.csv]]}, projection=[c1a], output_ordering=[c1a@0 ASC NULLS LAST], has_header=true
443443

444444
statement ok

datafusion/expr/src/utils.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -730,10 +730,13 @@ pub fn from_plan(
730730
inputs: &[LogicalPlan],
731731
) -> Result<LogicalPlan> {
732732
match plan {
733-
LogicalPlan::Projection(_) => Ok(LogicalPlan::Projection(Projection::try_new(
734-
expr.to_vec(),
735-
Arc::new(inputs[0].clone()),
736-
)?)),
733+
LogicalPlan::Projection(Projection { schema, .. }) => {
734+
Ok(LogicalPlan::Projection(Projection::try_new_with_schema(
735+
expr.to_vec(),
736+
Arc::new(inputs[0].clone()),
737+
schema.clone(),
738+
)?))
739+
}
737740
LogicalPlan::Dml(DmlStatement {
738741
table_name,
739742
table_schema,

0 commit comments

Comments
 (0)