You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "avantgardnerio (via GitHub)" <gi...@apache.org> on 2023/02/25 19:48:05 UTC

[GitHub] [arrow-datafusion] avantgardnerio commented on pull request #5366: feat: eliminate unnecessary projection.

avantgardnerio commented on PR #5366:
URL: https://github.com/apache/arrow-datafusion/pull/5366#issuecomment-1445190852

   Merging this PR seems to have broken two tests in `main`:
   
   ```
   
   
   
   expected:
   
   [
       "Explain [plan_type:Utf8, plan:Utf8]",
       "  Projection: t1.t1_id, t1.t1_name, t1.t1_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "    Filter: EXISTS (<subquery>) [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "      Subquery: [t1_int:UInt32;N]",
       "        Projection: t1.t1_int [t1_int:UInt32;N]",
       "          Filter: t1.t1_id > t1.t1_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "            TableScan: t1 [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "      TableScan: t1 projection=[t1_id, t1_name, t1_int] [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
   ]
   actual:
   
   [
       "Explain [plan_type:Utf8, plan:Utf8]",
       "  Filter: EXISTS (<subquery>) [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "    Subquery: [t1_int:UInt32;N]",
       "      Projection: t1.t1_int [t1_int:UInt32;N]",
       "        Filter: t1.t1_id > t1.t1_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "          TableScan: t1 [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "    TableScan: t1 projection=[t1_id, t1_name, t1_int] [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
   ]
   
   
   Left:  ["Explain [plan_type:Utf8, plan:Utf8]", "  Projection: t1.t1_id, t1.t1_name, t1.t1_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]", "    Filter: EXISTS (<subquery>) [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]", "      Subquery: [t1_int:U ...
   
   Right: ["Explain [plan_type:Utf8, plan:Utf8]", "  Filter: EXISTS (<subquery>) [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]", "    Subquery: [t1_int:UInt32;N]", "      Projection: t1.t1_int [t1_int:UInt32;N]", "        Filter: t1.t1_id > t1.t1_int [t1_i ...
   
   <Click to see difference>
   
   thread 'sql::subqueries::exists_subquery_with_same_table' panicked at 'assertion failed: `(left == right)`
     left: `["Explain [plan_type:Utf8, plan:Utf8]", "  Projection: t1.t1_id, t1.t1_name, t1.t1_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]", "    Filter: EXISTS (<subquery>) [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]", "      Subquery: [t1_int:UInt32;N]", "        Projection: t1.t1_int [t1_int:UInt32;N]", "          Filter: t1.t1_id > t1.t1_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]", "            TableScan: t1 [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]", "      TableScan: t1 projection=[t1_id, t1_name, t1_int] [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]"]`,
    right: `["Explain [plan_type:Utf8, plan:Utf8]", "  Filter: EXISTS (<subquery>) [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]", "    Subquery: [t1_int:UInt32;N]", "      Projection: t1.t1_int [t1_int:UInt32;N]", "        Filter: t1.t1_id > t1.t1_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]", "          TableScan: t1 [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]", "    TableScan: t1 projection=[t1_id, t1_name, t1_int] [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]"]`: 
   
   expected:
   
   [
       "Explain [plan_type:Utf8, plan:Utf8]",
       "  Projection: t1.t1_id, t1.t1_name, t1.t1_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "    Filter: EXISTS (<subquery>) [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "      Subquery: [t1_int:UInt32;N]",
       "        Projection: t1.t1_int [t1_int:UInt32;N]",
       "          Filter: t1.t1_id > t1.t1_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "            TableScan: t1 [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "      TableScan: t1 projection=[t1_id, t1_name, t1_int] [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
   ]
   actual:
   
   [
       "Explain [plan_type:Utf8, plan:Utf8]",
       "  Filter: EXISTS (<subquery>) [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "    Subquery: [t1_int:UInt32;N]",
       "      Projection: t1.t1_int [t1_int:UInt32;N]",
       "        Filter: t1.t1_id > t1.t1_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "          TableScan: t1 [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "    TableScan: t1 projection=[t1_id, t1_name, t1_int] [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
   ]
   
   ', datafusion/core/tests/sql/subqueries.rs:143:5
   stack backtrace:
      0: rust_begin_unwind
                at /rustc/75a0be98f25a4b9de5afa0e15eb016e7f9627032/library/std/src/panicking.rs:575:5
      1: core::panicking::panic_fmt
                at /rustc/75a0be98f25a4b9de5afa0e15eb016e7f9627032/library/core/src/panicking.rs:64:14
      2: core::panicking::assert_failed_inner
      3: core::panicking::assert_failed
                at /rustc/75a0be98f25a4b9de5afa0e15eb016e7f9627032/library/core/src/panicking.rs:211:5
      4: sql_integration::sql::subqueries::exists_subquery_with_same_table::{{closure}}
                at ./tests/sql/subqueries.rs:143:5
      5: <core::pin::Pin<P> as core::future::future::Future>::poll
                at /rustc/75a0be98f25a4b9de5afa0e15eb016e7f9627032/library/core/src/future/future.rs:125:9
      6: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::{{closure}}::{{closure}}
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/scheduler/current_thread.rs:525:48
      7: tokio::coop::with_budget::{{closure}}
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/coop.rs:102:9
      8: std::thread::local::LocalKey<T>::try_with
                at /rustc/75a0be98f25a4b9de5afa0e15eb016e7f9627032/library/std/src/thread/local.rs:446:16
      9: std::thread::local::LocalKey<T>::with
                at /rustc/75a0be98f25a4b9de5afa0e15eb016e7f9627032/library/std/src/thread/local.rs:422:9
     10: tokio::coop::with_budget
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/coop.rs:95:5
     11: tokio::coop::budget
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/coop.rs:72:5
     12: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::{{closure}}
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/scheduler/current_thread.rs:525:25
     13: tokio::runtime::scheduler::current_thread::Context::enter
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/scheduler/current_thread.rs:349:19
     14: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/scheduler/current_thread.rs:524:36
     15: tokio::runtime::scheduler::current_thread::CoreGuard::enter::{{closure}}
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/scheduler/current_thread.rs:595:57
     16: tokio::macros::scoped_tls::ScopedKey<T>::set
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/macros/scoped_tls.rs:61:9
     17: tokio::runtime::scheduler::current_thread::CoreGuard::enter
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/scheduler/current_thread.rs:595:27
     18: tokio::runtime::scheduler::current_thread::CoreGuard::block_on
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/scheduler/current_thread.rs:515:19
     19: tokio::runtime::scheduler::current_thread::CurrentThread::block_on
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/scheduler/current_thread.rs:161:24
     20: tokio::runtime::Runtime::block_on
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/mod.rs:490:46
     21: sql_integration::sql::subqueries::exists_subquery_with_same_table
                at ./tests/sql/subqueries.rs:148:5
     22: sql_integration::sql::subqueries::exists_subquery_with_same_table::{{closure}}
                at ./tests/sql/subqueries.rs:121:47
     23: core::ops::function::FnOnce::call_once
                at /rustc/75a0be98f25a4b9de5afa0e15eb016e7f9627032/library/core/src/ops/function.rs:250:5
     24: core::ops::function::FnOnce::call_once
                at /rustc/75a0be98f25a4b9de5afa0e15eb016e7f9627032/library/core/src/ops/function.rs:250:5
   note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
   
   
   
   
   expected:
   
   [
       "Explain [plan_type:Utf8, plan:Utf8]",
       "  Projection: t1.t1_id, t1.t1_name, t1.t1_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "    LeftSemi Join: t1.t1_id = __correlated_sq_1.t1_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "      TableScan: t1 projection=[t1_id, t1_name, t1_int] [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "      SubqueryAlias: __correlated_sq_1 [t1_int:UInt32;N]",
       "        Projection: t1.t1_int AS t1_int [t1_int:UInt32;N]",
       "          Filter: t1.t1_id > t1.t1_int [t1_id:UInt32;N, t1_int:UInt32;N]",
       "            TableScan: t1 projection=[t1_id, t1_int] [t1_id:UInt32;N, t1_int:UInt32;N]",
   ]
   actual:
   
   [
       "Explain [plan_type:Utf8, plan:Utf8]",
       "  LeftSemi Join: t1.t1_id = __correlated_sq_1.t1_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "    TableScan: t1 projection=[t1_id, t1_name, t1_int] [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "    SubqueryAlias: __correlated_sq_1 [t1_int:UInt32;N]",
       "      Projection: t1.t1_int AS t1_int [t1_int:UInt32;N]",
       "        Filter: t1.t1_id > t1.t1_int [t1_id:UInt32;N, t1_int:UInt32;N]",
       "          TableScan: t1 projection=[t1_id, t1_int] [t1_id:UInt32;N, t1_int:UInt32;N]",
   ]
   
   
   Left:  ["Explain [plan_type:Utf8, plan:Utf8]", "  Projection: t1.t1_id, t1.t1_name, t1.t1_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]", "    LeftSemi Join: t1.t1_id = __correlated_sq_1.t1_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]", "   ...
   
   Right: ["Explain [plan_type:Utf8, plan:Utf8]", "  LeftSemi Join: t1.t1_id = __correlated_sq_1.t1_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]", "    TableScan: t1 projection=[t1_id, t1_name, t1_int] [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N] ...
   
   <Click to see difference>
   
   thread 'sql::subqueries::in_subquery_with_same_table' panicked at 'assertion failed: `(left == right)`
     left: `["Explain [plan_type:Utf8, plan:Utf8]", "  Projection: t1.t1_id, t1.t1_name, t1.t1_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]", "    LeftSemi Join: t1.t1_id = __correlated_sq_1.t1_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]", "      TableScan: t1 projection=[t1_id, t1_name, t1_int] [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]", "      SubqueryAlias: __correlated_sq_1 [t1_int:UInt32;N]", "        Projection: t1.t1_int AS t1_int [t1_int:UInt32;N]", "          Filter: t1.t1_id > t1.t1_int [t1_id:UInt32;N, t1_int:UInt32;N]", "            TableScan: t1 projection=[t1_id, t1_int] [t1_id:UInt32;N, t1_int:UInt32;N]"]`,
    right: `["Explain [plan_type:Utf8, plan:Utf8]", "  LeftSemi Join: t1.t1_id = __correlated_sq_1.t1_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]", "    TableScan: t1 projection=[t1_id, t1_name, t1_int] [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]", "    SubqueryAlias: __correlated_sq_1 [t1_int:UInt32;N]", "      Projection: t1.t1_int AS t1_int [t1_int:UInt32;N]", "        Filter: t1.t1_id > t1.t1_int [t1_id:UInt32;N, t1_int:UInt32;N]", "          TableScan: t1 projection=[t1_id, t1_int] [t1_id:UInt32;N, t1_int:UInt32;N]"]`: 
   
   expected:
   
   [
       "Explain [plan_type:Utf8, plan:Utf8]",
       "  Projection: t1.t1_id, t1.t1_name, t1.t1_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "    LeftSemi Join: t1.t1_id = __correlated_sq_1.t1_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "      TableScan: t1 projection=[t1_id, t1_name, t1_int] [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "      SubqueryAlias: __correlated_sq_1 [t1_int:UInt32;N]",
       "        Projection: t1.t1_int AS t1_int [t1_int:UInt32;N]",
       "          Filter: t1.t1_id > t1.t1_int [t1_id:UInt32;N, t1_int:UInt32;N]",
       "            TableScan: t1 projection=[t1_id, t1_int] [t1_id:UInt32;N, t1_int:UInt32;N]",
   ]
   actual:
   
   [
       "Explain [plan_type:Utf8, plan:Utf8]",
       "  LeftSemi Join: t1.t1_id = __correlated_sq_1.t1_int [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "    TableScan: t1 projection=[t1_id, t1_name, t1_int] [t1_id:UInt32;N, t1_name:Utf8;N, t1_int:UInt32;N]",
       "    SubqueryAlias: __correlated_sq_1 [t1_int:UInt32;N]",
       "      Projection: t1.t1_int AS t1_int [t1_int:UInt32;N]",
       "        Filter: t1.t1_id > t1.t1_int [t1_id:UInt32;N, t1_int:UInt32;N]",
       "          TableScan: t1 projection=[t1_id, t1_int] [t1_id:UInt32;N, t1_int:UInt32;N]",
   ]
   
   ', datafusion/core/tests/sql/subqueries.rs:174:5
   stack backtrace:
      0: rust_begin_unwind
                at /rustc/75a0be98f25a4b9de5afa0e15eb016e7f9627032/library/std/src/panicking.rs:575:5
      1: core::panicking::panic_fmt
                at /rustc/75a0be98f25a4b9de5afa0e15eb016e7f9627032/library/core/src/panicking.rs:64:14
      2: core::panicking::assert_failed_inner
      3: core::panicking::assert_failed
                at /rustc/75a0be98f25a4b9de5afa0e15eb016e7f9627032/library/core/src/panicking.rs:211:5
      4: sql_integration::sql::subqueries::in_subquery_with_same_table::{{closure}}
                at ./tests/sql/subqueries.rs:174:5
      5: <core::pin::Pin<P> as core::future::future::Future>::poll
                at /rustc/75a0be98f25a4b9de5afa0e15eb016e7f9627032/library/core/src/future/future.rs:125:9
      6: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::{{closure}}::{{closure}}
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/scheduler/current_thread.rs:525:48
      7: tokio::coop::with_budget::{{closure}}
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/coop.rs:102:9
      8: std::thread::local::LocalKey<T>::try_with
                at /rustc/75a0be98f25a4b9de5afa0e15eb016e7f9627032/library/std/src/thread/local.rs:446:16
      9: std::thread::local::LocalKey<T>::with
                at /rustc/75a0be98f25a4b9de5afa0e15eb016e7f9627032/library/std/src/thread/local.rs:422:9
     10: tokio::coop::with_budget
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/coop.rs:95:5
     11: tokio::coop::budget
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/coop.rs:72:5
     12: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::{{closure}}
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/scheduler/current_thread.rs:525:25
     13: tokio::runtime::scheduler::current_thread::Context::enter
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/scheduler/current_thread.rs:349:19
     14: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/scheduler/current_thread.rs:524:36
     15: tokio::runtime::scheduler::current_thread::CoreGuard::enter::{{closure}}
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/scheduler/current_thread.rs:595:57
     16: tokio::macros::scoped_tls::ScopedKey<T>::set
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/macros/scoped_tls.rs:61:9
     17: tokio::runtime::scheduler::current_thread::CoreGuard::enter
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/scheduler/current_thread.rs:595:27
     18: tokio::runtime::scheduler::current_thread::CoreGuard::block_on
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/scheduler/current_thread.rs:515:19
     19: tokio::runtime::scheduler::current_thread::CurrentThread::block_on
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/scheduler/current_thread.rs:161:24
     20: tokio::runtime::Runtime::block_on
                at /home/bgardner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.21.2/src/runtime/mod.rs:490:46
     21: sql_integration::sql::subqueries::in_subquery_with_same_table
                at ./tests/sql/subqueries.rs:179:5
     22: sql_integration::sql::subqueries::in_subquery_with_same_table::{{closure}}
                at ./tests/sql/subqueries.rs:152:43
     23: core::ops::function::FnOnce::call_once
                at /rustc/75a0be98f25a4b9de5afa0e15eb016e7f9627032/library/core/src/ops/function.rs:250:5
     24: core::ops::function::FnOnce::call_once
                at /rustc/75a0be98f25a4b9de5afa0e15eb016e7f9627032/library/core/src/ops/function.rs:250:5
   note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
   
   ```
   
   Likely because tests were run on the branch, there were no conflicts, then upon merge the merged output failed the tests?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org