duckdb icon indicating copy to clipboard operation
duckdb copied to clipboard

Collation support: LIKE operator and Scalar String functions

Open tiagokepe opened this issue 9 months ago • 1 comments

Hi all,

This PR provides support for collations in the LIKE operator and scalar string functions.

For the LIKE operator, we decompose the like pattern into segments using the CreateLikeMatcher, then we apply the collation on each individual literal, a brief discussion can be found here

For some cases, I had to change the bind_function_expression.cpp and push down the collations on each function child, as a good consequence the scalar string functions support collations.

I also adapted the like optimization rules to support collations while replacing the LIKE function for optimized functions such as suffix, prefix, and contains.

Examples are available on test/sql/collate/collate_like.test and test/sql/collate/collate_scalar_string_functions.test

tiagokepe avatar Jun 03 '24 16:06 tiagokepe