zhishengyk opened a new pull request, #59367:
URL: https://github.com/apache/doris/pull/59367
Description
Add `hamming_distance` function to calculate the Hamming distance between
two strings.
Changes
- BE: Implement `hamming_distance` in `function_string.cpp` with
`FunctionBinaryToType + HammingDistanceImpl`,
and raise an error when the two input strings have different lengths
instead of returning NULL.
- FE: Add `HammingDistance` scalar function in Nereids with `AlwaysNullable`
(returns NULL when any input is NULL).
- Test: Add BE-UT with `check_function_all_arg_comb` to cover all argument
combinations.
- Test: Add distributed regression test `test_hamming_distance.groovy`.
- Doc: [link to your doc PR in apache/doris-website].
Behavior
- Return type: BIGINT, the number of positions where corresponding
characters differ.
- Returns NULL if any input is NULL.
- Throws an error if the two strings have different lengths.
- Works for vector/vector, scalar/vector, vector/scalar, scalar/scalar
combinations.
Testing
- BE-UT: `./run-be-ut.sh` (pass).
- Regression: `./run-regression-test.sh --run test_hamming_distance` (pass).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]