jun-he commented on pull request #3965:
URL: https://github.com/apache/iceberg/pull/3965#issuecomment-1026551586
> Not sure if this behavior may be undesirable
>
> ```python
> >>> FixedType(length=8) is FixedType(length=8)
> False
>
> >>> FixedType(length=8) == FixedType(length=8)
> True
> ```
>
> is that the desired behavior?
Thanks @CircArgs for pointing it out. `is` is used to check the reference
equality. The implementation here seems matching what is implemented in Java,
i.e.
```
Assert.assertTrue(Types.FixedType.ofLength(10) !=
Types.FixedType.ofLength(10));
Assert.assertTrue(Types.FixedType.ofLength(10).equals(Types.FixedType.ofLength(10)));
```
I think the issue here is related to the consistency. For non-parameterized
types, `is` and `==` return the same results but for non non parameterized
types, they are not.
If we want to make `is` to be the same as `==`, one way is that we can cache
created non parameterized types, which seems to be the approach in
https://github.com/apache/iceberg/pull/4016.
--
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]