OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Compression.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <cstdint>
20 #include <vector>
21 
23 #include "Shared/sqltypes.h"
24 namespace Geospatial {
25 
26 int32_t get_compression_scheme(const SQLTypeInfo& ti);
27 
28 uint64_t compress_coord(double coord, const SQLTypeInfo& ti, bool x);
29 
30 uint64_t compress_null_point(const SQLTypeInfo& ti, bool x);
31 
32 bool is_null_point(const SQLTypeInfo& geo_ti,
33  const int8_t* coords,
34  const size_t coords_sz);
35 
36 // Compress non-NULL geo coords; and also NULL POINT coords (special case)
37 std::vector<uint8_t> compress_coords(const std::vector<double>& coords,
38  const SQLTypeInfo& ti);
39 
40 template <typename T>
41 void unpack_geo_vector(std::vector<T>& output, const int8_t* input_ptr, const size_t sz);
42 
43 template <typename T, typename C>
44 std::shared_ptr<std::vector<T>> decompress_coords(const C& compression,
45  const int8_t* coords,
46  const size_t coords_sz);
47 } // namespace Geospatial
int32_t get_compression_scheme(const SQLTypeInfo &ti)
Definition: Compression.cpp:23
bool is_null_point(const SQLTypeInfo &geo_ti, const int8_t *coords, const size_t coords_sz)
Constants for Builtin SQL Types supported by HEAVY.AI.
DEVICE ALWAYS_INLINE Point2D coord(const int8_t *data, const int32_t x_index, const int32_t ic, const int32_t isr, const int32_t osr)
std::vector< uint8_t > compress_coords(const std::vector< double > &coords, const SQLTypeInfo &ti)
Definition: Compression.cpp:52
std::shared_ptr< std::vector< T > > decompress_coords(const C &compression, const int8_t *coords, const size_t coords_sz)
uint64_t compress_coord(double coord, const SQLTypeInfo &ti, bool x)
Definition: Compression.cpp:33
uint64_t compress_null_point(const SQLTypeInfo &ti, bool x)
Definition: Compression.cpp:41
void unpack_geo_vector(std::vector< T > &output, const int8_t *input_ptr, const size_t sz)