alamb commented on code in PR #7250:
URL: https://github.com/apache/arrow-datafusion/pull/7250#discussion_r1292217776
##########
datafusion/core/src/physical_plan/sorts/sort.rs:
##########
@@ -847,29 +853,54 @@ impl ExecutionPlan for SortExec {
trace!("End SortExec's input.execute for partition: {}", partition);
- let mut sorter = ExternalSorter::new(
- partition,
- input.schema(),
- self.expr.clone(),
- context.session_config().batch_size(),
- self.fetch,
- execution_options.sort_spill_reservation_bytes,
- execution_options.sort_in_place_threshold_bytes,
- &self.metrics_set,
- context.runtime_env(),
- );
+ if let Some(fetch) = self.fetch.as_ref() {
Review Comment:
Thank you @tustvold and @gruuya -- these are good ideas.
Maybe we can figure out how to switch between sort and TopK dynamically --
like if TopK exceeds some memory threshold revert back to the normal
ExternalSorter. Let me think about this 🤔
##########
datafusion/core/src/physical_plan/sorts/sort.rs:
##########
@@ -847,29 +853,54 @@ impl ExecutionPlan for SortExec {
trace!("End SortExec's input.execute for partition: {}", partition);
- let mut sorter = ExternalSorter::new(
- partition,
- input.schema(),
- self.expr.clone(),
- context.session_config().batch_size(),
- self.fetch,
- execution_options.sort_spill_reservation_bytes,
- execution_options.sort_in_place_threshold_bytes,
- &self.metrics_set,
- context.runtime_env(),
- );
+ if let Some(fetch) = self.fetch.as_ref() {
Review Comment:
Thank you @tustvold and @gruuya -- these are good ideas.
Maybe we can figure out how to switch between sort and TopK dynamically --
like if TopK exceeds some memory threshold revert back to the normal
ExternalSorter. Let me think about this 🤔
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]