Skip to content

Conversation

@AbhinavMishra32
Copy link

  • The Jira issue number for this PR is: MDEV-38180

Description

Adds native SQL functions XXH32() and XXH3() exposing xxHash algorithms.

Release Notes

Added XXH32() and XXH3() SQL functions that return 32‑bit and 64‑bit xxHash digests (unsigned integers). NULL or empty input returns SQL NULL.

How can this PR be tested?

./mysql-test/mtr main.func_xxh

If the changes are not amenable to automated testing, please explain why not and carefully describe how to test manually.

Basing the PR against the correct MariaDB version

  • This is a new feature or a refactoring, and the PR is based against the main branch.
  • This is a bug fix, and the PR is based against the earliest maintained branch in which the bug can be reproduced.

PR quality check

  • I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

@CLAassistant
Copy link

CLAassistant commented Dec 26, 2025

CLA assistant check
All committers have signed the CLA.

@AbhinavMishra32 AbhinavMishra32 changed the base branch from main to bb-main-mdev-9826-v4 December 26, 2025 19:42
@gkodinov gkodinov added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Dec 29, 2025
@AbhinavMishra32
Copy link
Author

@FooBarrior @mariadb-YuchenPei please review🙂

Copy link
Contributor

@gkodinov gkodinov left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution!

This is a preliminary review.

Please consider filling up a complete specification of the function into the related jira. E.g.: How does it calculate the hash for various data types, how does collation matter for strings, type and number of arguments, nullability, expected data type etc.

Please also find one additional optional arguments suggestion below.

return 0;
}

uint32_t h= XXH32((const void*) res->ptr(), res->length(), 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW, PHP (https://php.watch/versions/8.1/xxHash) supports passing "secret" and "seed" to the XXHASH function. Should you consider the same?
These can be optional too.

@gkodinov gkodinov requested a review from abarkov January 5, 2026 12:40
@gkodinov gkodinov assigned gkodinov and abarkov and unassigned gkodinov Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements.

Development

Successfully merging this pull request may close these issues.

4 participants