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 DISTINCT over DECIMALS #2330

Merged
merged 7 commits into from
Feb 16, 2024
Merged

Fix DISTINCT over DECIMALS #2330

merged 7 commits into from
Feb 16, 2024

Conversation

jycor
Copy link
Contributor

@jycor jycor commented Feb 16, 2024

There was another place where we were using hashstructure package, which does not hash decimal.Decimal types correctly.
Switched to xxhash package, which is what we use everywhere else.

Reusing solution from: #2279

This will fix 1 sqllogictest.

Copy link
Contributor

@max-hoffman max-hoffman left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -31,16 +33,36 @@ func (de *DistinctExpression) seenValue(ctx *sql.Context, value interface{}) (bo
de.dispose = dispose
}

hash, err := hashstructure.Hash(value, nil)
// TODO: how to handle nil?
Copy link
Contributor

Choose a reason for hiding this comment

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

docstring might be helpful, I'm assuming nil doesn't hash so we need to keep a variable for it? Should the close function set seenNil back to false in case the expression is reused?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep nil can't be hashed; I definitely need to set seenNil back to false in Dispose() method. Will fix!

@jycor jycor merged commit ee2cccf into main Feb 16, 2024
7 checks passed
@jycor jycor deleted the james/agg branch February 16, 2024 22:53
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.

2 participants