Turi Create  4.0
sort_and_merge.hpp
1 /* Copyright © 2017 Apple Inc. All rights reserved.
2  *
3  * Use of this source code is governed by a BSD-3-clause license that can
4  * be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
5  */
6 #ifndef TURI_QUERY_EVAL_SORT_AND_MERGE_HPP
7 #define TURI_QUERY_EVAL_SORT_AND_MERGE_HPP
8 
9 namespace turi {
10 namespace query_eval {
11 
12 #include <memory>
13 /**
14  * \ingroup sframe_query_engine
15  * \addtogroup Algorithms Algorithms
16  * \{
17  */
18 
19 /**
20  * \internal
21  * The merge stage of \ref sort.
22  *
23  * The input is a partially sorted(partitioned) sframe, represented by
24  * an sarray<string> with N segments. Each segment
25  * is a partitioned key range, and segments are ordered by
26  * the key orders.
27  *
28  * Given the partially sorted sframe, this function will in parallel
29  * sort each partition, and concat the result into final sframe.
30  *
31  * \param partition_array the serialized input sframe, partially sorted
32  * \param partition_sorted flag whether the partition is already sorted
33  * \param partition_sizes the estimate size of each partition
34  * \param sort_orders sort order of the keys
35  * \param permute_order The output order of the keys. column {permute_order[i]}
36  * will be stored in column i of the final SFrame
37  * \param column_names column names of the final sframe
38  * \param column_types column types of the final sframe
39  *
40  * \return a sorted sframe.
41  */
42 std::shared_ptr<sframe> sort_and_merge(
43  const std::shared_ptr<sarray<std::pair<flex_list, std::string>>>& partition_array,
44  const std::vector<bool>& partition_sorted,
45  const std::vector<size_t>& partition_sizes,
46  const std::vector<bool>& sort_orders,
47  const std::vector<size_t>& permute_order,
48  const std::vector<std::string>& column_names,
49  const std::vector<flex_type_enum>& column_types);
50 
51 /// \}
52 } // enfd of query_eval
53 } // end of turicreate
54 #endif
std::shared_ptr< sframe > sort_and_merge(const std::shared_ptr< sarray< std::pair< flex_list, std::string >>> &partition_array, const std::vector< bool > &partition_sorted, const std::vector< size_t > &partition_sizes, const std::vector< bool > &sort_orders, const std::vector< size_t > &permute_order, const std::vector< std::string > &column_names, const std::vector< flex_type_enum > &column_types)