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 2021/06/24 12:49:27 UTC

[GitHub] [arrow] jpedroantunes opened a new pull request #10595: ARROW-13163: [C++][Gandiva] Implement REPEAT function on Gandiva

jpedroantunes opened a new pull request #10595:
URL: https://github.com/apache/arrow/pull/10595


    Implement REPEAT function on Gandiva which concatenate a string "n" times.
   - REPEAT(str, int)


-- 
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:
users@infra.apache.org



[GitHub] [arrow] projjal commented on pull request #10595: ARROW-13163: [C++][Gandiva] Implement REPEAT function on Gandiva

Posted by GitBox <gi...@apache.org>.
projjal commented on pull request #10595:
URL: https://github.com/apache/arrow/pull/10595#issuecomment-868282599


   lgtm. Can you fix the checkstyle error


-- 
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:
users@infra.apache.org



[GitHub] [arrow] praveenbingo closed pull request #10595: ARROW-13163: [C++][Gandiva] Implement REPEAT function on Gandiva

Posted by GitBox <gi...@apache.org>.
praveenbingo closed pull request #10595:
URL: https://github.com/apache/arrow/pull/10595


   


-- 
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



[GitHub] [arrow] github-actions[bot] commented on pull request #10595: ARROW-13163: [C++][Gandiva] Implement REPEAT function on Gandiva

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #10595:
URL: https://github.com/apache/arrow/pull/10595#issuecomment-867609943


   https://issues.apache.org/jira/browse/ARROW-13163


-- 
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:
users@infra.apache.org



[GitHub] [arrow] praveenbingo closed pull request #10595: ARROW-13163: [C++][Gandiva] Implement REPEAT function on Gandiva

Posted by GitBox <gi...@apache.org>.
praveenbingo closed pull request #10595:
URL: https://github.com/apache/arrow/pull/10595


   


-- 
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



[GitHub] [arrow] jpedroantunes commented on pull request #10595: ARROW-13163: [C++][Gandiva] Implement REPEAT function on Gandiva

Posted by GitBox <gi...@apache.org>.
jpedroantunes commented on pull request #10595:
URL: https://github.com/apache/arrow/pull/10595#issuecomment-867611311


   @augustoasilva can you review it please?


-- 
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:
users@infra.apache.org



[GitHub] [arrow] augustoasilva commented on a change in pull request #10595: ARROW-13163: [C++][Gandiva] Implement REPEAT function on Gandiva

Posted by GitBox <gi...@apache.org>.
augustoasilva commented on a change in pull request #10595:
URL: https://github.com/apache/arrow/pull/10595#discussion_r658347627



##########
File path: cpp/src/gandiva/precompiled/string_ops_test.cc
##########
@@ -194,6 +194,34 @@ TEST(TestStringOps, TestConvertReplaceInvalidUtf8Char) {
   ctx.Reset();
 }
 
+TEST(TestStringOps, TestRepeat) {
+  gandiva::ExecutionContext ctx;
+  uint64_t ctx_ptr = reinterpret_cast<gdv_int64>(&ctx);
+  gdv_int32 out_len = 0;
+
+  const char* out_str = repeat_utf8_int32(ctx_ptr, "abc", 3, 2, &out_len);
+  EXPECT_EQ(std::string(out_str, out_len), "abcabc");
+  EXPECT_FALSE(ctx.has_error());
+
+  out_str = repeat_utf8_int32(ctx_ptr, "a", 1, 5, &out_len);
+  EXPECT_EQ(std::string(out_str, out_len), "aaaaa");
+  EXPECT_FALSE(ctx.has_error());
+
+  out_str = repeat_utf8_int32(ctx_ptr, "", 0, 10, &out_len);
+  EXPECT_EQ(std::string(out_str, out_len), "");
+  EXPECT_FALSE(ctx.has_error());
+
+  out_str = repeat_utf8_int32(ctx_ptr, "", -20, 10, &out_len);
+  EXPECT_EQ(std::string(out_str, out_len), "");
+  EXPECT_FALSE(ctx.has_error());
+
+  out_str = repeat_utf8_int32(ctx_ptr, "a", 1, -10, &out_len);
+  EXPECT_EQ(std::string(out_str, out_len), "");
+  EXPECT_THAT(ctx.get_error(),
+              ::testing::HasSubstr("Repeat number can't be negative"));
+  ctx.Reset();
+}
+

Review comment:
       Wouldn't it be good to also put a case where you have a value passed that generates a nullptr, thus making the error of not being able to allocate memory?




-- 
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:
users@infra.apache.org