v.23.5Improvement

bitHammingDistance function now supports String and FixedString data types

bitHammingDistance function support String and FixedString data type. Closes #48827. #49858 (flynn).
The bitHammingDistance function now supports String and FixedString data types.

Why it matters

This enhancement allows users to calculate the Hamming distance between binary representations of string values directly, expanding the applicability of bitHammingDistance beyond numeric types. It simplifies operations involving bitwise comparisons of string data, which is useful in tasks like similarity detection or error correction.

How to use it

Use the bitHammingDistance function with columns or values of String or FixedString types in your SQL queries, for example:

SELECT bitHammingDistance('string1', 'string2')


This will compute the bitwise Hamming distance between the two strings.