Skip to content

Conversation

@jackwener
Copy link
Member

@jackwener jackwener commented Dec 1, 2022

Which issue does this PR close?

Filter has access method which function like get() in object-oriented.

Rust don't need like get() method for struct. Because default immutable.

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added core Core DataFusion crate logical-expr Logical plan and expressions optimizer Optimizer rules labels Dec 1, 2022
@jackwener jackwener changed the title remove Object-oriented get methods of Filter. remove Object-oriented methods of Filter. Dec 1, 2022
@jackwener jackwener changed the title remove Object-oriented methods of Filter. remove Object-oriented methods of Filter and make field pub. Dec 1, 2022
@jackwener jackwener changed the title remove Object-oriented methods of Filter and make field pub. remove access methods of Filter and make field pub. Dec 1, 2022
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

seems reasonable to me. Thanks @jackwener

@alamb alamb added the api change Changes the API exposed to users of the crate label Dec 2, 2022
pub struct Filter {
/// The predicate expression, which must have Boolean type.
predicate: Expr,
pub predicate: Expr,
Copy link
Contributor

@tustvold tustvold Dec 3, 2022

Choose a reason for hiding this comment

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

I think this would allow side-stepping the schema validation in try_new? I don't know how important this is

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but I think it isn't a problem.
Projection Aggregate Subquery .... also is like this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can at least document what invariants are required between fields

Copy link
Member

Choose a reason for hiding this comment

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

I think this would allow side-stepping the schema validation in try_new? I don't know how important this is

Yes, the motivation for the current design (introduced in #3796) was to prevent invalid filters from being created.

@andygrove
Copy link
Member

What problem is this PR solving? It is partially reverting changes from #3796 that were introduced to prevent some class of errors when constructing plans.

@jackwener
Copy link
Member Author

Got it, Thanks your explanation @andygrove

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api change Changes the API exposed to users of the crate core Core DataFusion crate logical-expr Logical plan and expressions optimizer Optimizer rules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants