1 | #include "duckdb/storage/compression/patas/patas.hpp" |
2 | #include "duckdb/storage/compression/patas/patas_compress.hpp" |
3 | #include "duckdb/storage/compression/patas/patas_scan.hpp" |
4 | #include "duckdb/storage/compression/patas/patas_fetch.hpp" |
5 | #include "duckdb/storage/compression/patas/patas_analyze.hpp" |
6 | |
7 | #include "duckdb/common/limits.hpp" |
8 | #include "duckdb/common/types/null_value.hpp" |
9 | #include "duckdb/function/compression/compression.hpp" |
10 | #include "duckdb/function/compression_function.hpp" |
11 | #include "duckdb/main/config.hpp" |
12 | #include "duckdb/storage/buffer_manager.hpp" |
13 | |
14 | #include "duckdb/storage/table/column_data_checkpointer.hpp" |
15 | #include "duckdb/storage/table/column_segment.hpp" |
16 | #include "duckdb/common/operator/subtract.hpp" |
17 | |
18 | #include <functional> |
19 | |
20 | namespace duckdb { |
21 | |
22 | template <class T> |
23 | CompressionFunction GetPatasFunction(PhysicalType data_type) { |
24 | throw NotImplementedException("GetPatasFunction not implemented for the given datatype" ); |
25 | } |
26 | |
27 | template <> |
28 | CompressionFunction GetPatasFunction<float>(PhysicalType data_type) { |
29 | return CompressionFunction(CompressionType::COMPRESSION_PATAS, data_type, PatasInitAnalyze<float>, |
30 | PatasAnalyze<float>, PatasFinalAnalyze<float>, PatasInitCompression<float>, |
31 | PatasCompress<float>, PatasFinalizeCompress<float>, PatasInitScan<float>, |
32 | PatasScan<float>, PatasScanPartial<float>, PatasFetchRow<float>, PatasSkip<float>); |
33 | } |
34 | |
35 | template <> |
36 | CompressionFunction GetPatasFunction<double>(PhysicalType data_type) { |
37 | return CompressionFunction(CompressionType::COMPRESSION_PATAS, data_type, PatasInitAnalyze<double>, |
38 | PatasAnalyze<double>, PatasFinalAnalyze<double>, PatasInitCompression<double>, |
39 | PatasCompress<double>, PatasFinalizeCompress<double>, PatasInitScan<double>, |
40 | PatasScan<double>, PatasScanPartial<double>, PatasFetchRow<double>, PatasSkip<double>); |
41 | } |
42 | |
43 | CompressionFunction PatasCompressionFun::GetFunction(PhysicalType type) { |
44 | switch (type) { |
45 | case PhysicalType::FLOAT: |
46 | return GetPatasFunction<float>(data_type: type); |
47 | case PhysicalType::DOUBLE: |
48 | return GetPatasFunction<double>(data_type: type); |
49 | default: |
50 | throw InternalException("Unsupported type for Patas" ); |
51 | } |
52 | } |
53 | |
54 | bool PatasCompressionFun::TypeIsSupported(PhysicalType type) { |
55 | switch (type) { |
56 | case PhysicalType::FLOAT: |
57 | case PhysicalType::DOUBLE: |
58 | return true; |
59 | default: |
60 | return false; |
61 | } |
62 | } |
63 | |
64 | } // namespace duckdb |
65 | |