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/07/18 18:59:27 UTC

[GitHub] [arrow] SG011 commented on a diff in pull request #13600: ARROW-17067: [C++][Gandiva] Implement Substring_Index Function.

SG011 commented on code in PR #13600:
URL: https://github.com/apache/arrow/pull/13600#discussion_r923716916


##########
cpp/src/gandiva/tests/projector_test.cc:
##########
@@ -2824,6 +2824,49 @@ TEST_F(TestProjector, TestUCase) {
   EXPECT_ARROW_ARRAY_EQUALS(out_1, outputs.at(0));
 }
 
+TEST_F(TestProjector, TestSubstringIndex) {
+  auto field1 = field("f1", arrow::utf8());
+  auto field2 = field("f2", arrow::utf8());
+  auto field3 = field("f3", arrow::int32());
+  auto schema = arrow::schema({field1, field2, field3});
+
+  // output fields
+  auto substring_index = field("substring", arrow::utf8());
+
+  // Build expression
+  auto substring_expr = TreeExprBuilder::MakeExpression(
+      "substring_index", {field1, field2, field3}, substring_index);
+
+  std::shared_ptr<Projector> projector;
+
+  auto status =
+      Projector::Make(schema, {substring_expr}, TestConfiguration(), &projector);
+
+  EXPECT_TRUE(status.ok());
+
+  // Create a row-batch with some sample data
+  int num_records = 3;
+
+  auto array1 = MakeArrowArrayUtf8({"www||mysql||com", "www||mysql||com", "S;DCGS;JO!L"},

Review Comment:
   Have added them.



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