Turi Create  4.0
operator_transformations.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_SFRAME_QUERY_OPERATOR_TRANSFORMATIONS_H_
7 #define TURI_SFRAME_QUERY_OPERATOR_TRANSFORMATIONS_H_
8 
9 #include <core/storage/query_engine/operators/all_operators.hpp>
10 #include <core/storage/query_engine/operators/operator_properties.hpp>
11 
12 namespace turi { namespace query_eval {
13 
14 /** Turns a node graph into the proper segmented part.
15  */
16 pnode_ptr make_segmented_graph(pnode_ptr n, size_t split_idx, size_t n_splits,
17  std::map<pnode_ptr, pnode_ptr>& memo);
18 
19 /** Slice the node graph input with begin and end.
20  *
21  * Note:
22  * 1. only allows forward slice, i.e begin_index <= end_index
23  * 2. allows recursive slice, for example:
24  *
25  * \code
26  * n1 = make_sliced_graph(n0, 5, 10) // n1 contains row 5 to 9 of n0
27  * n2 = make_sliced_graph(n1, 1, 2) // n2 contains row 1 of n1, which is row 6 of n0
28  * \endcode
29  *
30  * 3. final slice range cannot exeeds the original graph
31  *
32  * \code
33  * n1 = make_sliced_graph(n0, 0, n0.size() +1) // throws error
34  * \endcode
35  */
36 pnode_ptr make_sliced_graph(pnode_ptr n, size_t begin_index, size_t end_index,
37  std::map<pnode_ptr, pnode_ptr>& memo);
38 }}
39 
40 #endif /* _OPERATOR_TRANSFORMATIONS_H_ */
pnode_ptr make_sliced_graph(pnode_ptr n, size_t begin_index, size_t end_index, std::map< pnode_ptr, pnode_ptr > &memo)
pnode_ptr make_segmented_graph(pnode_ptr n, size_t split_idx, size_t n_splits, std::map< pnode_ptr, pnode_ptr > &memo)
std::shared_ptr< planner_node > pnode_ptr
A handy typedef.