Skip to content

SortExec No Longer Streams Correctly #1939

@tustvold

Description

@tustvold

Describe the bug

https://github.com/apache/arrow-datafusion/pull/1596/files#diff-68811b72d27f9f5173223e0da1af2a467c2e4fff2f5f2237665fa29e1a6575c0L165 appears to have accidentally changed the behaviour of SortExec so that it no longer returns a stream that performs the sort operation, but instead performs the sort within ExecutionPlan::execute.

This effectively stalls out constructing the rest of the physical plan until the sort has completed, and prevents result streaming from working correctly.

To Reproduce

Run a query with a large SortExec, observe surprising amount of time spent in ExecutionPlan::execute

Expected behavior

ExecutionPlan::execute should return a stream of results, but should not block on those results being available

Additional context

This resulted in what looked like missing traces in IOx (https://github.com/influxdata/influxdb_iox/issues/3822) as it never actually finished constructing the physical plan from which to collect metrics 😅

FYI @yjshen

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions