23 #ifndef QUERYENGINE_RESULTSET_GEOSERIALIZATION_H
24 #define QUERYENGINE_RESULTSET_GEOSERIALIZATION_H
34 using namespace Geospatial;
36 template <SQLTypes GEO_SOURCE_TYPE>
38 static_assert(
IS_GEO(GEO_SOURCE_TYPE),
"Invalid geo type for target value serializer.");
41 template <SQLTypes GEO_SOURCE_TYPE>
43 static_assert(
IS_GEO(GEO_SOURCE_TYPE),
"Invalid geo type for wkt serializer.");
46 template <SQLTypes GEO_SOURCE_TYPE>
48 static_assert(
IS_GEO(GEO_SOURCE_TYPE),
49 "Invalid geo type for target value ptr serializer.");
52 template <ResultSet::GeoReturnType GEO_RETURN_TYPE, SQLTypes GEO_SOURCE_TYPE>
57 "ResultSet: Unrecognized Geo Return Type encountered.");
60 template <SQLTypes GEO_SOURCE_TYPE>
65 template <SQLTypes GEO_SOURCE_TYPE>
70 template <SQLTypes GEO_SOURCE_TYPE>
79 std::array<VarlenDatumPtr, 1>& vals) {
86 geo_ti, vals[0]->pointer, vals[0]->length)});
93 std::array<VarlenDatumPtr, 1>& vals) {
99 geo_ti, vals[0]->pointer, vals[0]->length));
107 std::array<VarlenDatumPtr, 1>& vals) {
121 std::array<VarlenDatumPtr, 1>& vals) {
123 return GeoTargetValue(boost::optional<GeoMultiPointTargetValue>{});
127 geo_ti, vals[0]->pointer, vals[0]->length)});
134 std::array<VarlenDatumPtr, 1>& vals) {
140 geo_ti, vals[0]->pointer, vals[0]->length));
148 std::array<VarlenDatumPtr, 1>& vals) {
162 std::array<VarlenDatumPtr, 1>& vals) {
164 return GeoTargetValue(boost::optional<GeoLineStringTargetValue>{});
168 geo_ti, vals[0]->pointer, vals[0]->length)});
175 std::array<VarlenDatumPtr, 1>& vals) {
181 geo_ti, vals[0]->pointer, vals[0]->length));
189 std::array<VarlenDatumPtr, 1>& vals) {
203 std::array<VarlenDatumPtr, 2>& vals) {
204 if (!geo_ti.
get_notnull() && (vals[0]->is_null || vals[1]->is_null)) {
205 return GeoTargetValue(boost::optional<GeoMultiLineStringTargetValue>{});
207 std::vector<int32_t> linestring_sizes_vec;
211 geo_ti, vals[0]->pointer, vals[0]->length),
212 linestring_sizes_vec);
220 std::array<VarlenDatumPtr, 2>& vals) {
221 if (!geo_ti.
get_notnull() && (vals[0]->is_null || vals[1]->is_null)) {
225 std::vector<int32_t> linestring_sizes_vec;
228 geo_ti, vals[0]->pointer, vals[0]->length),
229 linestring_sizes_vec);
237 std::array<VarlenDatumPtr, 2>& vals) {
238 if (!geo_ti.
get_notnull() && (vals[0]->is_null || vals[1]->is_null)) {
251 std::array<VarlenDatumPtr, 2>& vals) {
252 if (!geo_ti.
get_notnull() && (vals[0]->is_null || vals[1]->is_null)) {
255 std::vector<int32_t> ring_sizes_vec;
258 geo_ti, vals[0]->pointer, vals[0]->length),
267 std::array<VarlenDatumPtr, 2>& vals) {
268 if (!geo_ti.
get_notnull() && (vals[0]->is_null || vals[1]->is_null)) {
272 std::vector<int32_t> ring_sizes_vec;
275 geo_ti, vals[0]->pointer, vals[0]->length),
284 std::array<VarlenDatumPtr, 2>& vals) {
285 if (!geo_ti.
get_notnull() && (vals[0]->is_null || vals[1]->is_null)) {
298 std::array<VarlenDatumPtr, 3>& vals) {
300 (vals[0]->is_null || vals[1]->is_null || vals[2]->is_null)) {
301 return GeoTargetValue(boost::optional<GeoMultiPolyTargetValue>{});
303 std::vector<int32_t> ring_sizes_vec;
305 std::vector<int32_t> poly_rings_vec;
308 geo_ti, vals[0]->pointer, vals[0]->length),
318 std::array<VarlenDatumPtr, 3>& vals) {
320 (vals[0]->is_null || vals[1]->is_null || vals[2]->is_null)) {
324 std::vector<int32_t> ring_sizes_vec;
326 std::vector<int32_t> poly_rings_vec;
329 geo_ti, vals[0]->pointer, vals[0]->length),
339 std::array<VarlenDatumPtr, 3>& vals) {
341 (vals[0]->is_null || vals[1]->is_null || vals[2]->is_null)) {
347 {std::move(vals[0]), std::move(vals[1]), std::move(vals[2])});
351 #endif // QUERYENGINE_RESULTSET_GEOSERIALIZATION_H
static TargetValue serialize(const SQLTypeInfo &geo_ti, std::array< VarlenDatumPtr, 1 > &vals)
static TargetValue serialize(const SQLTypeInfo &geo_ti, std::array< VarlenDatumPtr, 2 > &vals)
static TargetValue serialize(const SQLTypeInfo &geo_ti, std::array< VarlenDatumPtr, 3 > &vals)
static TargetValue serialize(const SQLTypeInfo &geo_ti, std::array< VarlenDatumPtr, 2 > &vals)
static TargetValue serialize(const SQLTypeInfo &geo_ti, std::array< VarlenDatumPtr, 3 > &vals)
static TargetValue serialize(const SQLTypeInfo &geo_ti, std::array< VarlenDatumPtr, 1 > &vals)
static TargetValue serialize(const SQLTypeInfo &geo_ti, std::array< VarlenDatumPtr, 2 > &vals)
High-level representation of SQL values.
Constants for Builtin SQL Types supported by HEAVY.AI.
static TargetValue serialize(const SQLTypeInfo &geo_ti, std::array< VarlenDatumPtr, 2 > &vals)
static TargetValue serialize(const SQLTypeInfo &geo_ti, std::array< VarlenDatumPtr, 1 > &vals)
std::shared_ptr< std::vector< double > > decompress_coords< double, SQLTypeInfo >(const SQLTypeInfo &geo_ti, const int8_t *coords, const size_t coords_sz)
static TargetValue serialize(const SQLTypeInfo &geo_ti, std::array< VarlenDatumPtr, 1 > &vals)
static TargetValue serialize(const SQLTypeInfo &geo_ti, std::array< VarlenDatumPtr, 1 > &vals)
static TargetValue serialize(const SQLTypeInfo &geo_ti, std::array< VarlenDatumPtr, 1 > &vals)
boost::optional< boost::variant< GeoPointTargetValue, GeoMultiPointTargetValue, GeoLineStringTargetValue, GeoMultiLineStringTargetValue, GeoPolyTargetValue, GeoMultiPolyTargetValue >> GeoTargetValue
static TargetValue serialize(const SQLTypeInfo &geo_ti, std::array< VarlenDatumPtr, 1 > &vals)
static TargetValue serialize(const SQLTypeInfo &geo_ti, std::array< VarlenDatumPtr, 2 > &vals)
static TargetValue serialize(const SQLTypeInfo &geo_ti, std::array< VarlenDatumPtr, 3 > &vals)
boost::variant< GeoPointTargetValuePtr, GeoMultiPointTargetValuePtr, GeoLineStringTargetValuePtr, GeoMultiLineStringTargetValuePtr, GeoPolyTargetValuePtr, GeoMultiPolyTargetValuePtr > GeoTargetValuePtr
boost::variant< std::string, void * > NullableString
static TargetValue serialize(const SQLTypeInfo &geo_ti, std::array< VarlenDatumPtr, 1 > &vals)
std::string getWktString() const
static TargetValue serialize(const SQLTypeInfo &geo_ti, std::array< VarlenDatumPtr, 2 > &vals)
Basic constructors and methods of the row set interface.
boost::variant< ScalarTargetValue, ArrayTargetValue, GeoTargetValue, GeoTargetValuePtr > TargetValue
HOST DEVICE bool get_notnull() const
static TargetValue serialize(const SQLTypeInfo &geo_ti, std::array< VarlenDatumPtr, 1 > &vals)
std::unique_ptr< VarlenDatum > VarlenDatumPtr
void unpack_geo_vector(std::vector< T > &output, const int8_t *input_ptr, const size_t sz)