vegarsti commented on code in PR #16985:
URL: https://github.com/apache/datafusion/pull/16985#discussion_r2427035745
##########
datafusion/physical-plan/src/unnest.rs:
##########
@@ -99,11 +107,64 @@ impl UnnestExec {
/// This function creates the cache object that stores the plan properties
such as schema, equivalence properties, ordering, partitioning, etc.
fn compute_properties(
input: &Arc<dyn ExecutionPlan>,
+ list_column_indices: &[ListUnnest],
+ struct_column_indices: &[usize],
schema: SchemaRef,
) -> PlanProperties {
+ let list_column_indices: Vec<usize> = list_column_indices
+ .iter()
+ .map(|list_unnest| list_unnest.index_in_input_schema)
+ .collect();
+ let non_unnested_indices: Vec<usize> = input
+ .schema()
+ .fields()
+ .iter()
+ .enumerate()
+ .filter(|(idx, _)| {
+ !list_column_indices.contains(idx) &&
!struct_column_indices.contains(idx)
Review Comment:
> Otherwise, I think changing the iterator to
(0..input_schema.fields().len()) would help with readability as you don't seem
to be using the actual field.
Definitely doing this! Thank you.
Good idea to index into it. I'll give that a shot and see how it turns out!
##########
datafusion/physical-plan/src/unnest.rs:
##########
@@ -99,11 +107,64 @@ impl UnnestExec {
/// This function creates the cache object that stores the plan properties
such as schema, equivalence properties, ordering, partitioning, etc.
fn compute_properties(
input: &Arc<dyn ExecutionPlan>,
+ list_column_indices: &[ListUnnest],
+ struct_column_indices: &[usize],
schema: SchemaRef,
) -> PlanProperties {
+ let list_column_indices: Vec<usize> = list_column_indices
+ .iter()
+ .map(|list_unnest| list_unnest.index_in_input_schema)
+ .collect();
+ let non_unnested_indices: Vec<usize> = input
+ .schema()
+ .fields()
+ .iter()
+ .enumerate()
+ .filter(|(idx, _)| {
+ !list_column_indices.contains(idx) &&
!struct_column_indices.contains(idx)
Review Comment:
> Otherwise, I think changing the iterator to
(0..input_schema.fields().len()) would help with readability as you don't seem
to be using the actual field.
Definitely doing this! Thank you.
Good idea to build a buffer and index into it. I'll give that a shot and see
how it turns out!
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]