Skip to content

Conversation

@kim
Copy link
Contributor

@kim kim commented Nov 12, 2024

Change TxId::num_distinct_values to return Option<NonZeroU64>.

It will now return None if either the table doesn't exist, no index
exists for the given column list, or the index is empty.
Otherwise, Some non-zero number of distinct values is returned.

Fixes a division-by-zero bug in the query row estimation.

Expected complexity level and risk

1

Testing

No functional change, estimation::index_row_est is now statically guaranteed
to not panic due to division-by-zero

Change `TxId::num_distinct_values` to return `Option<NonZeroU64>`.

It will now return `None` if either the table doesn't exist, no index
exists for the given column list, or the index is empty.
Otherwise, `Some` non-zero number of distinct values is returned.

Fixes a division-by-zero bug in the query row estimation.
@kim kim force-pushed the kim/fix/nonzero-ndv branch from 047827f to 16a7126 Compare November 14, 2024 10:56
@kim kim added this pull request to the merge queue Nov 14, 2024
Merged via the queue into master with commit 33c4aab Nov 14, 2024
7 checks passed
@kim kim deleted the kim/fix/nonzero-ndv branch November 14, 2024 11:34
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.

5 participants