milesgranger commented on code in PR #14495:
URL: https://github.com/apache/arrow/pull/14495#discussion_r1015810833


##########
cpp/src/arrow/compute/api_scalar.h:
##########
@@ -277,12 +277,16 @@ class ARROW_EXPORT SetLookupOptions : public 
FunctionOptions {
 class ARROW_EXPORT StructFieldOptions : public FunctionOptions {
  public:
   explicit StructFieldOptions(std::vector<int> indices);
+  explicit StructFieldOptions(std::initializer_list<int>);
+  explicit StructFieldOptions(FieldRef field_ref,
+                              std::vector<int> indices = std::vector<int>());
   StructFieldOptions();
   static constexpr char const kTypeName[] = "StructFieldOptions";
 
   /// The child indices to extract. For instance, to get the 2nd child
   /// of the 1st child of a struct or union, this would be {0, 1}.
   std::vector<int> indices;
+  FieldRef field_ref;

Review Comment:
   Great thanks! I'll take you up on that offer right away. :wink: 
   
   When removing `indices`, I get a compilation error for missing `operator<<` 
since `FieldRef` is now used in the `kStructFieldOptionsType`'s `DataMember` in 
`api_scalar.cc`
   
   <details>
   <summary>snippet of error</summary>
   <\br>
   <code>
   /home/milesg/Projects/arrow/cpp/src/arrow/compute/function_internal.h:663:3: 
  required from 'const arrow::compute::FunctionOptionsType* 
arrow::compute::internal::GetFunctionOptionsType(const Properties& ...) [with 
Options = arrow::compute::StructFieldOptions; Properties = 
{arrow::internal::DataMemberProperty<arrow::compute::StructFieldOptions, 
arrow::FieldRef>}]'
   /home/milesg/Projects/arrow/cpp/src/arrow/compute/api_scalar.cc:362:60:   
required from here
   /home/milesg/Projects/arrow/cpp/src/arrow/compute/function_internal.h:102:6: 
error: no match for 'operator<<' (operand types are 'std::stringstream' {aka 
'std::__cxx11::basic_stringstream<char>'} and 'const arrow::FieldRef')
     102 |   ss << value;
         |   ~~~^~~~~~~~
   </code>
   </details>
   
   which is reminiscent of [a similar error I'm having in another 
PR](https://github.com/apache/arrow/pull/14395#discussion_r1012926565)
   
   I _think_ I know how to go about fixing it, implementing a similar 
`GenericToString` in `function_internal.h`, but as with that PR, not sure where 
to put that `operator<<` impl. 



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