niyue commented on code in PR #38873:
URL: https://github.com/apache/arrow/pull/38873#discussion_r1408791594


##########
cpp/src/gandiva/to_date_holder.cc:
##########
@@ -66,17 +65,15 @@ Status ToDateHolder::Make(const FunctionNode& node,
     suppress_errors = std::get<int>(literal_suppress_errors->holder());
   }
 
-  return Make(pattern, suppress_errors, holder);
+  return Make(pattern, suppress_errors);
 }
 
-Status ToDateHolder::Make(const std::string& sql_pattern, int32_t 
suppress_errors,
-                          std::shared_ptr<ToDateHolder>* holder) {
+Result<std::shared_ptr<ToDateHolder>> ToDateHolder::Make(const std::string& 
sql_pattern,
+                                                         int32_t 
suppress_errors) {
   std::shared_ptr<std::string> transformed_pattern;
   ARROW_RETURN_NOT_OK(DateUtils::ToInternalFormat(sql_pattern, 
&transformed_pattern));
-  auto lholder = std::shared_ptr<ToDateHolder>(
-      new ToDateHolder(*(transformed_pattern.get()), suppress_errors));
-  *holder = lholder;
-  return Status::OK();
+  return std::shared_ptr<ToDateHolder>(
+      new ToDateHolder(*transformed_pattern, suppress_errors));

Review Comment:
   Explained above.



##########
cpp/src/gandiva/to_date_holder_test.cc:
##########
@@ -143,15 +136,13 @@ TEST_F(TestToDateHolder, TestSimpleDateTimeError) {
 }
 
 TEST_F(TestToDateHolder, TestSimpleDateTimeMakeError) {
-  std::shared_ptr<ToDateHolder> to_date_holder;
   // reject time stamps for now.
-  auto status = ToDateHolder::Make("YYYY-MM-DD HH:MI:SS tzo", 0, 
&to_date_holder);
+  auto const status = ToDateHolder::Make("YYYY-MM-DD HH:MI:SS tzo", 
0).status();
   EXPECT_EQ(status.IsInvalid(), true) << status.message();

Review Comment:
   Updated.



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

Reply via email to