zanmato1984 commented on PR #48267:
URL: https://github.com/apache/arrow/pull/48267#issuecomment-3625757909

   > How about this instead:
   > 
   > ```diff
   > diff --git a/cpp/src/arrow/compute/function_internal.h 
b/cpp/src/arrow/compute/function_internal.h
   > index 9d8928466b..96bdbacf04 100644
   > --- a/cpp/src/arrow/compute/function_internal.h
   > +++ b/cpp/src/arrow/compute/function_internal.h
   > @@ -347,7 +347,8 @@ static inline Result<std::shared_ptr<Scalar>> 
GenericToScalar(
   >  static inline Result<std::shared_ptr<Scalar>> GenericToScalar(
   >      const std::shared_ptr<DataType>& value) {
   >    if (!value) {
   > -    return Status::Invalid("shared_ptr<DataType> is nullptr");
   > +    // An omitted DataType is serialized as boolean true
   > +    return MakeScalar(boolean(), true);
   >    }
   >    return MakeNullScalar(value);
   >  }
   > @@ -448,6 +449,10 @@ static inline enable_if_same_result<T, SortKey> 
GenericFromScalar(
   >  template <typename T>
   >  static inline enable_if_same_result<T, std::shared_ptr<DataType>> 
GenericFromScalar(
   >      const std::shared_ptr<Scalar>& value) {
   > +  if (value->type->id() == Type::BOOL && value->is_valid) {
   > +    // Boolean true represents an omitted DataType (nullptr)
   > +    return nullptr;
   > +  }
   >    return value->type;
   >  }
   > ```
   > 
   > Also, should add a test in `expression_test.cc` (see 
`SerializationRoundTrips`)
   
   Feels a bit hacky imho.


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