in csrc/velox/functions/string_functions.h [359:404]
bool call(bool& result, const arg_type<velox::Varchar>& input) {
using namespace velox::functions;
using namespace internal;
size_t size = input.size();
if (size == 0) {
result = false;
return true;
}
size_t index = 0;
bool has_alph = false;
bool has_alph_upper = false;
while (index < size) {
int codePointSize;
utf8proc_int32_t codePoint =
utf8proc_codepoint(input.data() + index, codePointSize);
utf8proc_category_t category =
static_cast<utf8proc_category_t>(utf8proc_category(codePoint));
if (Utf8CatUtils::isAlpha(category)) {
has_alph = true;
if (Utf8CatUtils::isUpper(category)) {
// False if it has more than 1 upper or title case
if (has_alph_upper) {
result = false;
return true;
} else {
has_alph_upper = true;
}
} else { // isLower
if (!has_alph_upper) {
// False if it only has lower case
result = false;
return true;
}
}
} else {
has_alph_upper = false;
}
index += codePointSize;
}
result = has_alph;
return true;
}