vvellanki commented on a change in pull request #11166:
URL: https://github.com/apache/arrow/pull/11166#discussion_r744618852
##########
File path: cpp/src/gandiva/tests/projector_test.cc
##########
@@ -1606,4 +1606,46 @@ TEST_F(TestProjector, TestCastNullableIntYearInterval) {
EXPECT_ARROW_ARRAY_EQUALS(out_int64, outputs.at(1));
}
+TEST_F(TestProjector, TestEltFunction) {
+ auto field0 = field("f0", arrow::int32());
+ auto field1 = field("f1", arrow::utf8());
+ auto field2 = field("f2", arrow::utf8());
+
+ auto schema0 = arrow::schema({field0, field1, field2});
+
+ // output fields
+ auto out_field0 = field("out_field0", arrow::utf8());
+
+ // Build expression
+ auto elt_expr0 =
+ TreeExprBuilder::MakeExpression("elt", {field0, field1, field2},
out_field0);
+
+ std::shared_ptr<Projector> projector1;
+
+ auto status = Projector::Make(schema0, {elt_expr0}, TestConfiguration(),
&projector1);
+ EXPECT_TRUE(status.ok());
+
+ // Create a row-batch with some sample data
+ int num_records = 5;
+
+ auto array0 = MakeArrowArrayInt32({1, 2, 4, 0, -2}, {true, true, true, true,
true});
Review comment:
Can you add a test case for the following:
1) Return the 1 element always
2) Make the first element have size larger than the 2nd element
3) Make the first element smaller in size compared to the 2nd element
Add a test where the pos keeps changing such that:
1) elt returns the input with smallest length in the input strings
2) elt returns the input with largest length in the input strings
3) elt returns a random input
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]