forked from apache/datafusion
-
Notifications
You must be signed in to change notification settings - Fork 2
Remove PartiallyOrdered handling from BoundedWindowAggExec #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mustafasrepo
wants to merge
24
commits into
apache_main
Choose a base branch
from
feature/window_partiall_ordered_remove
base: apache_main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 23 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
d022cf3
Remove partially ordered execution from bounded windowExec
mustafasrepo fe06250
Resolve linter error
mustafasrepo 9d103bc
Remove unnecessary code
mustafasrepo f0bed47
Aggregate starting code.
mustafasrepo f4583f2
Add aggregate handling
mustafasrepo 7bfe7ea
Add aggregate tests
mustafasrepo d9df3a0
Add aggregate literal ignore
mustafasrepo 4d798f3
Add partiallysorted check to the group ordering.
mustafasrepo e5880dc
Update tests to reflect new behaviour
mustafasrepo ece6418
Resolve linter errors, Remove unnecessary code.
mustafasrepo 5ec1067
Merge branch 'apache_main' into feature/window_partiall_ordered_remove
mustafasrepo 3523419
tmp
mustafasrepo f356f1a
Move impls to single rule
mustafasrepo d1a5d6d
Simplifications
mustafasrepo b494cab
Add invalidated ordering handling
mustafasrepo 4308adf
Minor changes
mustafasrepo 1e891fb
Resolve linter errors. Remove constants during input order mode analysis
mustafasrepo 8f5ef80
Simplifications
mustafasrepo 0981c2f
Bring back aggregate partial sort support
mustafasrepo e9e56de
Fix tests
mustafasrepo 6492611
Merge branch 'apache_main' into feature/window_partiall_ordered_remove
mustafasrepo d780937
Resolve linter errors
mustafasrepo 859da28
Minor changes
mustafasrepo e8a4aaa
Minor changes
mustafasrepo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -178,9 +178,10 @@ impl BoundedWindowAggExec { | |
| input_schema, | ||
| }) | ||
| } | ||
| InputOrderMode::Linear | InputOrderMode::PartiallySorted(_) => Box::new( | ||
| LinearSearch::new(ordered_partition_by_indices, input_schema), | ||
| ), | ||
| InputOrderMode::PartiallySorted(_) => { | ||
| return exec_err!("BoundedWindowAggExec cannot work in InputOrderMode::PartiallySorted mode."); | ||
| } | ||
| InputOrderMode::Linear => Box::new(LinearSearch::new(input_schema)), | ||
| }) | ||
| } | ||
|
|
||
|
|
@@ -435,11 +436,6 @@ pub struct LinearSearch { | |
| input_buffer_hashes: VecDeque<u64>, | ||
| /// Used during hash value calculation. | ||
| random_state: RandomState, | ||
| /// Input ordering and partition by key ordering need not be the same, so | ||
| /// this vector stores the mapping between them. For instance, if the input | ||
| /// is ordered by a, b and the window expression contains a PARTITION BY b, a | ||
| /// clause, this attribute stores [1, 0]. | ||
| ordered_partition_by_indices: Vec<usize>, | ||
| /// We use this [`RawTable`] to calculate unique partitions for each new | ||
| /// RecordBatch. First entry in the tuple is the hash value, the second | ||
| /// entry is the unique ID for each partition (increments from 0 to n). | ||
|
|
@@ -566,32 +562,12 @@ impl PartitionSearcher for LinearSearch { | |
| self.input_buffer_hashes.drain(0..n_out); | ||
| } | ||
|
|
||
| fn mark_partition_end(&self, partition_buffers: &mut PartitionBatches) { | ||
| // We should be in the `PartiallySorted` case, otherwise we can not | ||
| // tell when we are at the end of a given partition. | ||
| if !self.ordered_partition_by_indices.is_empty() { | ||
| if let Some((last_row, _)) = partition_buffers.last() { | ||
| let last_sorted_cols = self | ||
| .ordered_partition_by_indices | ||
| .iter() | ||
| .map(|idx| last_row[*idx].clone()) | ||
| .collect::<Vec<_>>(); | ||
| for (row, partition_batch_state) in partition_buffers.iter_mut() { | ||
| let sorted_cols = self | ||
| .ordered_partition_by_indices | ||
| .iter() | ||
| .map(|idx| &row[*idx]); | ||
| // All the partitions other than `last_sorted_cols` are done. | ||
| // We are sure that we will no longer receive values for these | ||
| // partitions (arrival of a new value would violate ordering). | ||
| partition_batch_state.is_end = !sorted_cols.eq(&last_sorted_cols); | ||
| } | ||
| } | ||
| } | ||
| fn mark_partition_end(&self, _partition_buffers: &mut PartitionBatches) { | ||
| // In Linear mode, We cannot mark a partition as ended | ||
| } | ||
|
|
||
| fn is_mode_linear(&self) -> bool { | ||
| self.ordered_partition_by_indices.is_empty() | ||
| true | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this necessary? |
||
| } | ||
|
|
||
| fn input_schema(&self) -> &SchemaRef { | ||
|
|
@@ -601,11 +577,10 @@ impl PartitionSearcher for LinearSearch { | |
|
|
||
| impl LinearSearch { | ||
| /// Initialize a new [`LinearSearch`] partition searcher. | ||
| fn new(ordered_partition_by_indices: Vec<usize>, input_schema: SchemaRef) -> Self { | ||
| fn new(input_schema: SchemaRef) -> Self { | ||
| LinearSearch { | ||
| input_buffer_hashes: VecDeque::new(), | ||
| random_state: Default::default(), | ||
| ordered_partition_by_indices, | ||
| row_map_batch: RawTable::with_capacity(256), | ||
| row_map_out: RawTable::with_capacity(256), | ||
| input_schema, | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.