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

Comparaison between RangePartitioning objects seems to be incorrect. #159

Closed
francois-baptiste opened this issue Jul 8, 2020 · 2 comments · Fixed by #162
Closed

Comparaison between RangePartitioning objects seems to be incorrect. #159

francois-baptiste opened this issue Jul 8, 2020 · 2 comments · Fixed by #162
Assignees
Labels
api: bigquery Issues related to the googleapis/python-bigquery API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@francois-baptiste
Copy link
Contributor

Comparaison between RangePartitioning objects seems to be incorrect.

Environment details

  • google-cloud-bigquery version: 1.25.0

Code example

from google.cloud.bigquery import RangePartitioning

print(RangePartitioning(field='something') ==
      RangePartitioning(field='something'))

Code above returns False. I was expecting True.

@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Jul 8, 2020
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Jul 9, 2020
@HemangChothani HemangChothani self-assigned this Jul 10, 2020
@HemangChothani
Copy link
Contributor

@francois-baptiste The magic of the equality operator == happens in the eq() class method of the object. This is a magic class method that’s called whenever an instance of this class is compared against another object. If this method is not implemented in the class , then == compares the memory addresses of the two objects by default.

You can compare like:

print (repr(RangePartitioning(field='something')) ==  repr(RangePartitioning(field='something')))

@francois-baptiste
Copy link
Contributor Author

Thank you @HemangChothani for the workaround. I think however that the eq() method should be implemented as the other class of the library.

@HemangChothani HemangChothani added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed triage me I really want to be triaged. labels Jul 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
3 participants