pitrou commented on code in PR #46261: URL: https://github.com/apache/arrow/pull/46261#discussion_r2129034145
########## cpp/src/arrow/compute/initialize.cc: ########## @@ -0,0 +1,90 @@ +// 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. +#include "arrow/compute/initialize.h" +#include "arrow/compute/registry.h" + +#include <algorithm> +#include <memory> +#include <mutex> +#include <unordered_map> +#include <utility> Review Comment: Almost none of these includes is necessary, right? ########## cpp/src/arrow/compute/initialize.cc: ########## @@ -0,0 +1,90 @@ +// 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. +#include "arrow/compute/initialize.h" +#include "arrow/compute/registry.h" + +#include <algorithm> +#include <memory> +#include <mutex> +#include <unordered_map> +#include <utility> + +#include "arrow/compute/function.h" +#include "arrow/compute/function_internal.h" +#include "arrow/compute/registry_internal.h" +#include "arrow/status.h" +#include "arrow/util/config.h" // For ARROW_COMPUTE +#include "arrow/util/logging.h" + +namespace arrow::compute { +namespace internal { Review Comment: This can be the anonymous namespace now that the function isn't exposed publicly. ########## cpp/src/arrow/compute/initialize.cc: ########## @@ -0,0 +1,90 @@ +// 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. +#include "arrow/compute/initialize.h" +#include "arrow/compute/registry.h" Review Comment: The convention is a bit random, but the header included at the top of the file should only be the one corresponding to the `.cc` file. So, here, `initialize.h` but not `registry.h`. ########## cpp/src/arrow/compute/initialize.cc: ########## @@ -0,0 +1,90 @@ +// 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. +#include "arrow/compute/initialize.h" +#include "arrow/compute/registry.h" + +#include <algorithm> +#include <memory> +#include <mutex> +#include <unordered_map> +#include <utility> + +#include "arrow/compute/function.h" +#include "arrow/compute/function_internal.h" +#include "arrow/compute/registry_internal.h" +#include "arrow/status.h" +#include "arrow/util/config.h" // For ARROW_COMPUTE Review Comment: How so? `ARROW_COMPUTE` isn't used here. ########## cpp/src/arrow/compute/initialize.cc: ########## @@ -0,0 +1,90 @@ +// 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. +#include "arrow/compute/initialize.h" +#include "arrow/compute/registry.h" + +#include <algorithm> +#include <memory> +#include <mutex> +#include <unordered_map> +#include <utility> + +#include "arrow/compute/function.h" +#include "arrow/compute/function_internal.h" +#include "arrow/compute/registry_internal.h" +#include "arrow/status.h" +#include "arrow/util/config.h" // For ARROW_COMPUTE +#include "arrow/util/logging.h" + +namespace arrow::compute { +namespace internal { + +Status RegisterComputeKernels() { + auto registry = GetFunctionRegistry(); + + // Register additional kernels on libarrow_compute + // Scalar functions + internal::RegisterScalarArithmetic(registry); Review Comment: Will this function compile if the additional kernels are not available? This is not really clear to me. -- 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]
