lidavidm commented on a change in pull request #10511:
URL: https://github.com/apache/arrow/pull/10511#discussion_r661554464



##########
File path: cpp/src/arrow/compute/function_internal.h
##########
@@ -0,0 +1,626 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <sstream>
+#include <string>
+#include <vector>
+
+#include "arrow/array/builder_base.h"
+#include "arrow/array/builder_binary.h"
+#include "arrow/array/builder_nested.h"
+#include "arrow/compute/api_vector.h"
+#include "arrow/compute/function.h"
+#include "arrow/compute/type_fwd.h"
+#include "arrow/result.h"
+#include "arrow/status.h"
+#include "arrow/util/checked_cast.h"
+#include "arrow/util/key_value_metadata.h"
+#include "arrow/util/reflection_internal.h"
+#include "arrow/util/string.h"
+#include "arrow/util/visibility.h"
+
+namespace arrow {
+struct Scalar;
+struct StructScalar;
+using ::arrow::internal::checked_cast;
+
+namespace internal {
+template <>
+struct EnumTraits<compute::SortOrder>

Review comment:
       I found it had to be here to be considered by the overloads of the 
Generic* functions for SortKey, which in turn I had to place in this header or 
they wouldn't be considered by the generated class in GetFunctionOptionsType. 
If I move all the overloads for SortKey/SortOrder into api_vector.cc, then I 
get errors like this:
   
   ```
   In file included from 
/home/lidavidm/Code/upstream/arrow-13025/cpp/src/arrow/compute/api_vector.cc:28:
   
/home/lidavidm/Code/upstream/arrow-13025/cpp/src/arrow/compute/function_internal.h:
 In instantiation of 'arrow::Result<std::shared_ptr<arrow::Scalar> > 
arrow::compute::internal::GenericToScalar(const std::vector<T>&) [with T = 
arrow::compute::SortKey]':
   
/home/lidavidm/Code/upstream/arrow-13025/cpp/src/arrow/compute/function_internal.h:462:34:
   required from 'void 
arrow::compute::internal::ToStructScalarImpl<Options>::operator()(const 
Property&, size_t) [with Property = 
arrow::internal::DataMemberProperty<arrow::compute::SortOptions, 
std::vector<arrow::compute::SortKey> >; Options = arrow::compute::SortOptions; 
size_t = long unsigned int]'
   
/home/lidavidm/Code/upstream/arrow-13025/cpp/src/arrow/util/reflection_internal.h:67:28:
   required from 'void arrow::internal::ForEachTupleMemberImpl(const 
std::tuple<_Elements ...>&, Fn&&, arrow::internal::index_sequence<I ...>) [with 
long unsigned int ...I = {0}; T = 
{arrow::internal::DataMemberProperty<arrow::compute::SortOptions, 
std::vector<arrow::compute::SortKey, std::allocator<arrow::compute::SortKey> > 
>}; Fn = 
arrow::compute::internal::ToStructScalarImpl<arrow::compute::SortOptions>&]'
   
/home/lidavidm/Code/upstream/arrow-13025/cpp/src/arrow/util/reflection_internal.h:72:25:
   required from 'void arrow::internal::ForEachTupleMember(const 
std::tuple<_Tps ...>&, Fn&&) [with T = 
{arrow::internal::DataMemberProperty<arrow::compute::SortOptions, 
std::vector<arrow::compute::SortKey, std::allocator<arrow::compute::SortKey> > 
>}; Fn = 
arrow::compute::internal::ToStructScalarImpl<arrow::compute::SortOptions>&]'
   
/home/lidavidm/Code/upstream/arrow-13025/cpp/src/arrow/util/reflection_internal.h:100:23:
   required from 'void 
arrow::internal::PropertyTuple<Properties>::ForEach(Fn&&) const [with Fn = 
arrow::compute::internal::ToStructScalarImpl<arrow::compute::SortOptions>&; 
Properties = {arrow::internal::DataMemberProperty<arrow::compute::SortOptions, 
std::vector<arrow::compute::SortKey, std::allocator<arrow::compute::SortKey> > 
>}]'
   
/home/lidavidm/Code/upstream/arrow-13025/cpp/src/arrow/compute/function_internal.h:456:5:
   required from 
'arrow::compute::internal::ToStructScalarImpl<Options>::ToStructScalarImpl(const
 Options&, const Tuple&, std::vector<std::__cxx11::basic_string<char> >*, 
std::vector<std::shared_ptr<arrow::Scalar> >*) [with Tuple = 
arrow::internal::PropertyTuple<arrow::internal::DataMemberProperty<arrow::compute::SortOptions,
 std::vector<arrow::compute::SortKey, std::allocator<arrow::compute::SortKey> > 
> >; Options = arrow::compute::SortOptions]'
   
/home/lidavidm/Code/upstream/arrow-13025/cpp/src/arrow/compute/function_internal.h:536:7:
   required from 'arrow::Status 
arrow::compute::internal::GetFunctionOptionsType(const Properties& 
...)::OptionsType::ToStructScalar(const arrow::compute::FunctionOptions&, 
std::vector<std::__cxx11::basic_string<char> >*, 
std::vector<std::shared_ptr<arrow::Scalar> >*) const [with Options = 
arrow::compute::SortOptions; Properties = 
{arrow::internal::DataMemberProperty<arrow::compute::SortOptions, 
std::vector<arrow::compute::SortKey, std::allocator<arrow::compute::SortKey> > 
>}]'
   
/home/lidavidm/Code/upstream/arrow-13025/cpp/src/arrow/compute/function_internal.h:550:3:
   required from 'const arrow::compute::FunctionOptionsType* 
arrow::compute::internal::GetFunctionOptionsType(const Properties& ...) [with 
Options = arrow::compute::SortOptions; Properties = 
{arrow::internal::DataMemberProperty<arrow::compute::SortOptions, 
std::vector<arrow::compute::SortKey, std::allocator<arrow::compute::SortKey> > 
>}]'
   
/home/lidavidm/Code/upstream/arrow-13025/cpp/src/arrow/compute/api_vector.cc:182:89:
   required from here
   
/home/lidavidm/Code/upstream/arrow-13025/cpp/src/arrow/compute/function_internal.h:264:59:
 error: no matching function for call to 
'GenericTypeSingleton<arrow::compute::SortKey>()'
     264 |   std::shared_ptr<DataType> type = GenericTypeSingleton<T>();
         |                                    ~~~~~~~~~~~~~~~~~~~~~~~^~
   ```




-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to