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

any(nil) is not equal to nil, should cast it as its original type #57326

Closed
AilinKid opened this issue Nov 12, 2024 · 2 comments · Fixed by #57428
Closed

any(nil) is not equal to nil, should cast it as its original type #57326

AilinKid opened this issue Nov 12, 2024 · 2 comments · Fixed by #57428
Assignees
Labels
planner/cascades issue/enhance/bug related to yams severity/minor sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@AilinKid
Copy link
Contributor

AilinKid commented Nov 12, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

func (col *Column) Equals(other any) bool {
	if other == nil {. // false
		return false
	}
        col2, ok := other.(*Column)
        // ok will be true
        // then col2 == nil is true 

when we pass var s *Column = nil into as other with type any here, we found it doesn't equal to nil anymore, unless we downcast it with *Column type before equaling with nil

1. Minimal reproduce step (Required)

2. What did you expect to see? (Required)

as mentioned
suggestion way

func (col *Column) Equals(other any) bool {
    col2, ok := other.(*Column)
    if !ok {
        return false
    }
    if col == nil {
        return col2==nil
    }
    if col2 == nil {
        return false
    }
    // normal equals logic appended

3. What did you see instead (Required)

as mentioned

4. What is your TiDB version? (Required)

master

@AilinKid AilinKid added type/bug The issue is confirmed as a bug. sig/planner SIG: Planner planner/cascades issue/enhance/bug related to yams labels Nov 12, 2024
@AilinKid AilinKid self-assigned this Nov 12, 2024
@King-Dylan
Copy link
Contributor

King-Dylan commented Nov 15, 2024

/severity minor

Copy link

ti-chi-bot bot commented Nov 15, 2024

@King-Dylan: The label(s) severity/minor cannot be applied. These labels are supported: fuzz/sqlancer, challenge-program, compatibility-breaker, first-time-contributor, contribution, good first issue, correctness, duplicate, proposal, security, needs-more-info, needs-cherry-pick-release-5.4, needs-cherry-pick-release-6.1, needs-cherry-pick-release-6.5, needs-cherry-pick-release-7.1, needs-cherry-pick-release-7.5, needs-cherry-pick-release-8.1, needs-cherry-pick-release-8.5, affects-5.4, affects-6.1, affects-6.5, affects-7.1, affects-7.5, affects-8.1, affects-8.4, affects-8.5, may-affects-5.4, may-affects-6.1, may-affects-6.5, may-affects-7.1, may-affects-7.5, may-affects-8.1, may-affects-8.5.

In response to this:

/label severity/minor

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
planner/cascades issue/enhance/bug related to yams severity/minor sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants