projjal commented on a change in pull request #10179:
URL: https://github.com/apache/arrow/pull/10179#discussion_r624650624
##########
File path: cpp/src/gandiva/like_holder.cc
##########
@@ -81,20 +81,31 @@ Status LikeHolder::Make(const FunctionNode& node,
std::shared_ptr<LikeHolder>* h
Status::Invalid(
"'like' function requires a string literal as the second
parameter"));
- return Make(arrow::util::get<std::string>(literal->holder()), holder);
+ RE2::Options regex_op;
+ if (node.descriptor()->name() == "ilike") {
+ regex_op.set_case_sensitive(false); // set case-insensitive for ilike
function.
+
+ return Make(arrow::util::get<std::string>(literal->holder()), holder,
regex_op);
+ }
+ return Make(arrow::util::get<std::string>(literal->holder()), holder,
regex_op);
}
Status LikeHolder::Make(const std::string& sql_pattern,
- std::shared_ptr<LikeHolder>* holder) {
+ std::shared_ptr<LikeHolder>* holder, RE2::Options
regex_op) {
std::string pcre_pattern;
ARROW_RETURN_NOT_OK(RegexUtil::SqlLikePatternToPcre(sql_pattern,
pcre_pattern));
- auto lholder = std::shared_ptr<LikeHolder>(new LikeHolder(pcre_pattern));
+ std::shared_ptr<LikeHolder> lholder;
+ if (regex_op.case_sensitive()) {
Review comment:
You can just call ``holder = std::shared_ptr<LikeHolder>(new
LikeHolder(pcre_pattern, regex_op));``
No need for if here
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]