Skip to content

Conversation

@alamb
Copy link
Contributor

@alamb alamb commented Jul 16, 2024

Which issue does this PR close?

This is a workaround + some tests for #11492

I don't think this should be merged, I am just posting it here so:

  1. Anyone else who hits it can see the workaround
  2. Add some tests

Rationale for this change

See #11492

What changes are included in this PR?

  1. Workaround
  2. Tests

Are these changes tested?

Yes

Are there any user-facing changes?

@github-actions github-actions bot added core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) labels Jul 16, 2024
11)------PlaceholderRowExec


###
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the code in this PR these tests fail like this:

(venv) andrewlamb@Andrews-MacBook-Pro-2:~/Software/datafusion2$ cargo test --test sqllogictests -- union
   Compiling datafusion v40.0.0 (/Users/andrewlamb/Software/datafusion2/datafusion/core)
   Compiling datafusion-sqllogictest v40.0.0 (/Users/andrewlamb/Software/datafusion2/datafusion/sqllogictest)
    Finished `test` profile [unoptimized + debuginfo] target(s) in 6.10s
     Running bin/sqllogictests.rs (target/debug/deps/sqllogictests-6e33fb5db6770e8f)
Running "pg_compat/pg_compat_union.slt"
Running "union.slt"
External error: query failed: DataFusion error: SanityCheckPlan
caused by
Error during planning: Child: ["UnionExec", "  SortExec: expr=[a@0 ASC NULLS LAST], preserve_partitioning=[true]", "    ProjectionExec: expr=[CAST(a@0 AS Utf8) as a]", "      RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1", "        CsvExec: file_groups={1 group: [[Users/andrewlamb/Software/datafusion2/datafusion/core/tests/data/example.csv]]}, projection=[a], output_ordering=[a@0 ASC NULLS LAST], has_header=true", "  ProjectionExec: expr=[bar as a]", "    CsvExec: file_groups={1 group: [[Users/andrewlamb/Software/datafusion2/datafusion/core/tests/data/example.csv]]}, has_header=true"] does not satisfy parent order requirements: [PhysicalSortRequirement { expr: Column { name: "a", index: 0 }, options: Some(SortOptions { descending: false, nulls_first: false }) }]
[SQL] SELECT (SELECT a from t ORDER BY a) UNION ALL (SELECT 'bar' as a from t) ORDER BY a;
at test_files/union.slt:629

@alamb alamb force-pushed the alamb/union_fix branch from c303b9f to 73196fd Compare July 16, 2024 16:27
if child.as_any().downcast_ref::<UnionExec>().is_some() {
continue;
}
if child.as_any().downcast_ref::<SortExec>().is_some() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Locally i had to disable checking for SortExec as well to get our tests passing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The likely cause is #11678

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant