kou commented on code in PR #13656:
URL: https://github.com/apache/arrow/pull/13656#discussion_r934151548
##########
cpp/src/gandiva/tests/projector_test.cc:
##########
@@ -3384,4 +3384,111 @@ TEST_F(TestProjector, TestMaskDefault) {
EXPECT_ARROW_ARRAY_EQUALS(exp_mask, outputs.at(0));
}
+TEST_F(TestProjector, TestSqrt) {
+ // input fields
+ auto field1 = field("f1", arrow::int32());
+ auto field2 = field("f2", arrow::int64());
+ auto field3 = field("f3", arrow::float32());
+ auto field4 = field("f4", arrow::float64());
+
+ // schema fields
+ auto schema1 = arrow::schema({field1});
+ auto schema2 = arrow::schema({field2});
+ auto schema3 = arrow::schema({field3});
+ auto schema4 = arrow::schema({field4});
+
+ // output fields
+ auto field5 = field("sqrt_int32", arrow::float64());
+ auto field6 = field("sqrt_int64", arrow::float64());
+ auto field7 = field("sqrt_float32", arrow::float64());
+ auto field8 = field("sqrt_float64", arrow::float64());
+
+ // Build expression
+ auto sqrt_int32 = TreeExprBuilder::MakeExpression("sqrt", {field1}, field5);
+ auto sqrt_int64 = TreeExprBuilder::MakeExpression("sqrt", {field2}, field6);
+ auto sqrt_float32 = TreeExprBuilder::MakeExpression("sqrt", {field3},
field7);
+ auto sqrt_float64 = TreeExprBuilder::MakeExpression("sqrt", {field4},
field8);
+
+ std::shared_ptr<Projector> projector1;
+
+ auto status = Projector::Make(schema1, {sqrt_int32}, TestConfiguration(),
&projector1);
+ EXPECT_TRUE(status.ok()) << status.message();
Review Comment:
OK. Please update the same patterns in another functions too. Do you want to
work on it in this pull request or a follow-up pull request?
Generally, we should remove redundant codes as much as possible for easy to
maintain.
--
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]