You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/03/03 10:44:04 UTC

[GitHub] [arrow] nivia007 commented on a change in pull request #12440: ARROW-15699: [C++][Gandiva] Fix implementation of left and right func…

nivia007 commented on a change in pull request #12440:
URL: https://github.com/apache/arrow/pull/12440#discussion_r818530942



##########
File path: cpp/src/gandiva/precompiled/string_ops.cc
##########
@@ -2207,6 +2213,12 @@ const char* right_utf8_int32(gdv_int64 context, const char* text, gdv_int32 text
     return "";
   }
 
+  //case where right('abcdef', -6) -> "" and right('abcdef', -7) -> ""
+  if(number < 0 && abs(number) >= text_len) {

Review comment:
       I tested it for left('abc¥', -4) and it is returning correct result, Would it better if I put this condition in the  for loop below
   if (number < 0 && char_count <= abs(number)) {
         *out_len = 0;
         return "";
       }




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org