lidavidm commented on a change in pull request #11274: URL: https://github.com/apache/arrow/pull/11274#discussion_r718837311
########## File path: cpp/src/arrow/compute/exec/select_k.cc ########## @@ -0,0 +1,74 @@ +// 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/exec/select_k.h" + +#include <functional> +#include <memory> +#include <mutex> +#include <vector> +#include "arrow/compute/api_vector.h" +#include "arrow/compute/exec/options.h" +#include "arrow/record_batch.h" +#include "arrow/result.h" +#include "arrow/status.h" +#include "arrow/table.h" +#include "arrow/type.h" + +namespace arrow { +namespace compute { + +class SelectKBasicImpl : public SelectKImpl { Review comment: I think such a version would work entirely differently, as you mention in the second paragraph. Each thread would track the top K values it's seen so far (not indices! - this would be more similar to something like hash_distinct), and at the end, all the thread states would be merged and then the top K values of the merged state would be taken. IMO, my inclination is not to factor things out like this right now, especially because the streaming version might not fit that well into this framework anyways? (It'd probably look like a cross between SinkNode and AggregateNode.) But the order by and select K nodes look extremely similar right now and could be consolidated if desired (though, I'm not sure what other kernels you'd want implemented) -- 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]
