Skip to content
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

Fix #13045 - Comparison of Structs and Struct Exprs #13226

Merged
merged 6 commits into from Jul 7, 2023

Conversation

ehigham
Copy link
Collaborator

@ehigham ehigham commented Jul 6, 2023

RR: #13045
RR: #13046
Support symmetric comparison of structs and struct expressions.
Provide better error messages when attempting to construct literals from expressions with free variables.

Comment on lines +97 to +99
return self._fields == other._fields \
if isinstance(other, Struct) \
else NotImplemented
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

@patrick-schultz patrick-schultz left a comment

Choose a reason for hiding this comment

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

Thanks Ed, looks great. Would you mind making the same fix for Interval, Locus, and Cal for consistency?

@ehigham
Copy link
Collaborator Author

ehigham commented Jul 7, 2023

Thanks Ed, looks great. Would you mind making the same fix for Interval, Locus, and Cal for consistency?

as you wish

Copy link
Collaborator

@patrick-schultz patrick-schultz left a comment

Choose a reason for hiding this comment

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

thanks!

Comment on lines 241 to 244
wrapper['has_free_vars'] = (
x._ir.free_vars.__len__() > 0 or
x._ir.free_agg_vars.__len__() > 0 or
x._ir.free_scan_vars.__len__() > 0
Copy link
Collaborator

Choose a reason for hiding this comment

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

This needs to be a |=, no?

Copy link
Collaborator Author

@ehigham ehigham Jul 7, 2023

Choose a reason for hiding this comment

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

no difference for positive integers?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I mean wrapper['has_free_vars'] |= .... Otherwise, if there are multiple nested expressions, and the last has no free variables but others do, we will only remember the False from the last.

Copy link
Collaborator Author

@ehigham ehigham Jul 7, 2023

Choose a reason for hiding this comment

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

Ah yes. Mutation. I forgot this can get called more than once

hail/python/hail/expr/functions.py Outdated Show resolved Hide resolved
@danking danking merged commit 07c4930 into hail-is:main Jul 7, 2023
8 checks passed
@ehigham ehigham deleted the ehigham/fix-13045-expr-__eq__ branch July 10, 2023 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants