Skip to content

Minor: add Window::try_new_with_schema constructor - #10850

Merged
alamb merged 1 commit into
apache:mainfrom
sdf-labs:bo/window-with-schema
Jun 10, 2024
Merged

alamb merged 1 commit into
apache:mainfrom
sdf-labs:bo/window-with-schema

Conversation

@sadboy

@sadboy sadboy commented Jun 10, 2024

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes N/A

Rationale for this change

This change makes the Window node API more uniform with other LogicalPlan nodes, which all expose both try_new and try_new_with_schema constructors.

What changes are included in this PR?

New method Window::try_new_with_schema

Are these changes tested?

Covered by existing tests.

Are there any user-facing changes?

No.

@github-actions github-actions Bot added the logical-expr Logical plan and expressions label Jun 10, 2024
@sadboy
sadboy marked this pull request as ready for review June 10, 2024 03:53

@alamb alamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me -- thank you @sadboy 🙏

I have a documentation suggestion, but I think that could be done as a follow on PR

)
}

pub fn try_new_with_schema(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we can add some documentation strings that explain how this is different than Window::try_new (specifically that the schema check is much faster)?

@alamb alamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I wonder if we could update at least one callsite to use try_new_with_schema so we get some test coverage 🤔

@sadboy

sadboy commented Jun 10, 2024

Copy link
Copy Markdown
Contributor Author

if we could update at least one callsite to use try_new_with_schema so we get some test coverage

Window::try_new actually calls try_new_with_schema to do the work, that's why I didn't bother adding new tests. Do you think that's sufficient coverage?

@alamb

alamb commented Jun 10, 2024

Copy link
Copy Markdown
Contributor

Window::try_new actually calls try_new_with_schema to do the work, that's why I didn't bother adding new tests. Do you think that's sufficient coverage?

I think it is reasonable enough 🤔 . It might be good as a follow on PR to add another external callsite so that we don't accidentally mess up this API by accident)

@alamb
alamb merged commit 0bd84e1 into apache:main Jun 10, 2024
@alamb

alamb commented Jun 10, 2024

Copy link
Copy Markdown
Contributor

Thanks again @sadboy -- We can add additional documentation as a follow on PR

findepi pushed a commit to findepi/datafusion that referenced this pull request Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

logical-expr Logical plan and expressions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants