Turi Create  4.0
sframe_compact.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_COMPACT_HPP
7 #define TURI_SFRAME_COMPACT_HPP
8 #include <vector>
9 #include <memory>
10 namespace turi {
11 class sframe;
12 
13 template <typename T>
14 class sarray;
15 /**
16  * sframe_fast_compact looks for runs of small segments
17  * (comprising of less than FAST_COMPACT_BLOCKS_IN_SMALL_SEGMENT block), and
18  * rebuilds them into bigger segments.
19  * Returns true if any compaction was performed.
20  */
21 bool sframe_fast_compact(const sframe& sf);
22 
23 /**
24  * Inplace compacts an SFrame. Fast compact is tried first and if
25  * the number of segments do not fall below the target, a slow compaction
26  * is performed.
27  */
28 void sframe_compact(sframe& sf, size_t segment_threshold);
29 
30 /**
31  * sarray_fast_compact looks for runs of small segments
32  * (comprising of less than FAST_COMPACT_BLOCKS_IN_SMALL_SEGMENT block), and
33  * rebuilds them into bigger segments.
34  * Returns true if any compaction was performed.
35  */
36 template <typename T>
37 bool sarray_fast_compact(sarray<T>& column);
38 
39 /**
40  * Inplace compacts an SArray. Fast compact is tried first and if
41  * the number of segments do not fall below the target, a slow compaction
42  * is performed.
43  */
44 template <typename T>
45 void sarray_compact(sarray<T>& column, size_t segment_threshold);
46 
47 } // turi
48 #endif
void sframe_compact(sframe &sf, size_t segment_threshold)
bool sframe_fast_compact(const sframe &sf)
bool sarray_fast_compact(sarray< T > &column)
void sarray_compact(sarray< T > &column, size_t segment_threshold)