infiniflow / infinity

The AI-native database built for LLM applications, providing incredibly fast hybrid search of dense vector, sparse vector, tensor (multi-vector), and full-text
https://infiniflow.org
Apache License 2.0
2.7k stars 275 forks source link

add strlen function #2217

Open zjbpaul1317 opened 2 weeks ago

zjbpaul1317 commented 2 weeks ago

What problem does this PR solve?

Briefly describe what this PR aims to solve. Include background context that will help reviewers understand the purpose of the PR.

Type of change

JinHai-CN commented 2 weeks ago

Since the result is filtered by strlen(c1) = 3, the output of strlen(c1) should be 3. Am I right?

SELECT *, strlen(c1) FROM test_varchar_filter WHERE strlen(c1) = 3;
----
abc abcd 5
JinHai-CN commented 2 weeks ago

Data type of varchar have two representation in Infinity. When check file src/parser/type/complex/varchar.h, you can find varchar data with length <= 13 and > 13 will have different memory layout. So the two cases should be tested in all function related with data type of varchar.

zjbpaul1317 commented 2 weeks ago

Data type of varchar have two representation in Infinity. When check file src/parser/type/complex/varchar.h, you can find varchar data with length <= 13 and > 13 will have different memory layout. So the two cases should be tested in all function related with data type of varchar.

Copy that