Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::Geometry Class Reference

Static Public Member Functions

static bool IsSpatialGeometryType (const LogicalType &type)
 Check for legayc geometry type (pre v1.5).
static LogicalType GetSpatialGeometryType ()
 Get legacy geometry type (pre v1.5).
static DUCKDB_API bool FromString (const string_t &wkt_text, string_t &result, Vector &result_vector, bool strict)
 Convert from WKT.
static DUCKDB_API bool FromString (const string_t &wkt_text, string_t &result, Vector &result_vector, bool strict, optional_idx query_location)
static DUCKDB_API string_t ToString (Vector &result, const string_t &geom)
 Convert to WKT.
static DUCKDB_API bool FromBinary (const string_t &wkb, string_t &result, Vector &result_vector, bool strict)
 Convert from WKB.
static DUCKDB_API bool FromBinary (Vector &source, Vector &result, idx_t count, bool strict)
static DUCKDB_API void ToBinary (Vector &source, Vector &result, idx_t count)
 Convert to WKB.
static DUCKDB_API pair< GeometryType, VertexType > GetType (const string_t &wkb)
 Get the geometry type and vertex type from the WKB.
static DUCKDB_API uint32_t GetExtent (const string_t &wkb, GeometryExtent &extent)
 Update the bounding box, return number of vertices processed.
static DUCKDB_API uint32_t GetExtent (const string_t &wkb, GeometryExtent &extent, bool &has_any_empty)
static DUCKDB_API void ToVectorizedFormat (Vector &source, Vector &target, idx_t count, GeometryType geom_type, VertexType vert_type)
 Convert to vectorized format.
static DUCKDB_API void ToVectorizedFormat (Vector &source, Vector &target, idx_t count, GeometryStorageType type)
static DUCKDB_API void FromVectorizedFormat (Vector &source, Vector &target, idx_t count, GeometryType geom_type, VertexType vert_type, idx_t result_offset)
 Convert from vectorized format.
static DUCKDB_API void FromVectorizedFormat (Vector &source, Vector &target, idx_t count, GeometryStorageType type, idx_t result_offset)
static DUCKDB_API LogicalType GetVectorizedType (GeometryStorageType type)
 Get the vectorized logical type for a given geometry and vertex type.
static DUCKDB_API LogicalType GetVectorizedType (GeometryType geom_type, VertexType vert_type)
static DUCKDB_API pair< GeometryType, VertexType > GetSpecializedType (GeometryStorageType type)
static DUCKDB_API void FromSpatialGeometry (const string_t &source, string_t &target, Vector &vector)
static DUCKDB_API void FromSpatialGeometry (Vector &source, Vector &target, idx_t count, idx_t result_offset)
static DUCKDB_API void FromSpatialGeometry (const string_t &source, string &target)
static DUCKDB_API void ToSpatialGeometry (const string_t &source, string_t &target, Vector &vector)
static DUCKDB_API void ToSpatialGeometry (Vector &source, Vector &target, idx_t count)
static DUCKDB_API void ToSpatialGeometry (const string_t &source, string &target)

Static Public Attributes

static constexpr idx_t MAX_RECURSION_DEPTH = 16
static constexpr idx_t VERSION_ADDED = 7

Member Function Documentation

◆ IsSpatialGeometryType()

bool duckdb::Geometry::IsSpatialGeometryType ( const LogicalType & type)
static

Check for legayc geometry type (pre v1.5).

120735 {
120736 return type.id() == LogicalTypeId::BLOB && type.HasAlias() && type.GetAlias() == "GEOMETRY";
120737}

◆ GetSpatialGeometryType()

LogicalType duckdb::Geometry::GetSpatialGeometryType ( )
static

Get legacy geometry type (pre v1.5).

120729 {
120730 auto blob_type = LogicalType(LogicalTypeId::BLOB);
120731 blob_type.SetAlias("GEOMETRY");
120732 return blob_type;
120733}
Here is the caller graph for this function:

◆ FromString() [1/2]

bool duckdb::Geometry::FromString ( const string_t & wkt_text,
string_t & result,
Vector & result_vector,
bool strict )
static

Convert from WKT.

118922 {
118923 return FromString(wkt_text, result, result_vector, strict, optional_idx::Invalid());
118924}
static DUCKDB_API bool FromString(const string_t &wkt_text, string_t &result, Vector &result_vector, bool strict)
Convert from WKT.
Definition duckdb.cpp:118922
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FromString() [2/2]

bool duckdb::Geometry::FromString ( const string_t & wkt_text,
string_t & result,
Vector & result_vector,
bool strict,
optional_idx query_location )
static
118910 {
118911 TextReader reader(wkt_text.GetData(), static_cast<uint32_t>(wkt_text.GetSize()));
118912 reader.SetQueryLocation(query_location);
118913 BlobWriter writer;
118914
118915 FromStringRecursive(reader, writer, 0, false, false);
118916
118917 const auto &buffer = writer.GetBuffer();
118918 result = StringVector::AddStringOrBlob(result_vector, buffer.data(), buffer.size());
118919 return true;
118920}
::uint32_t uint32_t
static DUCKDB_API string_t AddStringOrBlob(Vector &vector, const char *data, idx_t len)
Definition duckdb.cpp:137893

◆ ToString()

string_t duckdb::Geometry::ToString ( Vector & result,
const string_t & geom )
static

Convert to WKT.

118926 {
118927 BlobReader reader(geom.GetData(), static_cast<uint32_t>(geom.GetSize()));
118928 TextWriter writer;
118929
118930 ToStringRecursive(reader, writer, 0, false, false);
118931
118932 // Convert the buffer to string_t
118933 const auto &buffer = writer.GetBuffer();
118934 return StringVector::AddString(result, buffer.data(), buffer.size());
118935}
static DUCKDB_API string_t AddString(Vector &vector, const char *data, idx_t len)
Add a string to the string heap of the vector (auxiliary data).
Definition duckdb.cpp:137889
Here is the call graph for this function:

◆ FromBinary() [1/2]

bool duckdb::Geometry::FromBinary ( const string_t & wkb,
string_t & result,
Vector & result_vector,
bool strict )
static

Convert from WKB.

118853 {
118854 BlobReader reader(wkb.GetData(), static_cast<uint32_t>(wkb.GetSize()));
118855
118856 const auto analysis = AnalyzeWKB(reader);
118857 if (analysis.any_unknown) {
118858 if (strict) {
118859 throw InvalidInputException("Unsupported geometry type in WKB");
118860 }
118861 return false;
118862 }
118863
118864 if (analysis.any_be || analysis.any_ewkb) {
118865 reader.Reset();
118866 // Make a new WKB with all LE
118867 auto blob = StringVector::EmptyString(result_vector, analysis.size);
118868 FixedSizeBlobWriter writer(blob.GetDataWriteable(), static_cast<uint32_t>(blob.GetSize()));
118869 ConvertWKB(reader, writer);
118870 blob.Finalize();
118871 result = blob;
118872 return true;
118873 }
118874
118875 // Copy the WKB as-is
118876 result = StringVector::AddStringOrBlob(result_vector, wkb.GetData(), wkb.GetSize());
118877 return true;
118878}
static DUCKDB_API string_t EmptyString(Vector &vector, idx_t len)
Definition duckdb.cpp:137942
Here is the call graph for this function:

◆ FromBinary() [2/2]

bool duckdb::Geometry::FromBinary ( Vector & source,
Vector & result,
idx_t count,
bool strict )
static
118880 {
118881 if (strict) {
118882 UnaryExecutor::Execute<string_t, string_t>(source, result, count, [&](const string_t &wkb) {
118883 string_t geom;
118884 FromBinary(wkb, geom, result, true);
118885 return geom;
118886 });
118887 return true;
118888 }
118889
118890 auto all_ok = true;
118891 UnaryExecutor::ExecuteWithNulls<string_t, string_t>(source, result, count,
118892 [&](const string_t &wkb, ValidityMask &mask, idx_t idx) {
118893 string_t geom;
118894 if (!FromBinary(wkb, geom, result, false)) {
118895 all_ok = false;
118896 mask.SetInvalid(idx);
118897 return string_t();
118898 }
118899 return geom;
118900 });
118901 return all_ok;
118902}
static DUCKDB_API bool FromBinary(const string_t &wkb, string_t &result, Vector &result_vector, bool strict)
Convert from WKB.
Definition duckdb.cpp:118853
GMat mask(const GMat &src, const GMat &mask)
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ ToBinary()

void duckdb::Geometry::ToBinary ( Vector & source,
Vector & result,
idx_t count )
static

Convert to WKB.

118904 {
118905 // We are currently using WKB internally, so just copy as-is!
118906 result.Reinterpret(source);
118907}

◆ GetType()

pair< GeometryType, VertexType > duckdb::Geometry::GetType ( const string_t & wkb)
static

Get the geometry type and vertex type from the WKB.

118937 {
118938 BlobReader reader(wkb.GetData(), static_cast<uint32_t>(wkb.GetSize()));
118939
118940 // Read the byte order (should always be 1 for little-endian)
118941 const auto byte_order = reader.Read<uint8_t>();
118942 if (byte_order != 1) {
118943 throw InvalidInputException("Unsupported byte order %d in WKB", byte_order);
118944 }
118945
118946 const auto meta = reader.Read<uint32_t>();
118947 const auto type_id = (meta & 0x0000FFFF) % 1000;
118948 const auto flag_id = (meta & 0x0000FFFF) / 1000;
118949
118950 if (type_id < 1 || type_id > 7) {
118951 throw InvalidInputException("Unsupported geometry type %d in WKB", type_id);
118952 }
118953 if (flag_id > 3) {
118954 throw InvalidInputException("Unsupported geometry flag %d in WKB", flag_id);
118955 }
118956
118957 const auto geom_type = static_cast<GeometryType>(type_id);
118958 const auto vert_type = static_cast<VertexType>(flag_id);
118959
118960 return {geom_type, vert_type};
118961}
cv::GOpaque< T > meta(G g, const std::string &tag)
::uint8_t uint8_t

◆ GetExtent() [1/2]

uint32_t duckdb::Geometry::GetExtent ( const string_t & wkb,
GeometryExtent & extent )
static

Update the bounding box, return number of vertices processed.

119009 {
119010 bool has_any_empty = false;
119011 return GetExtent(wkb, extent, has_any_empty);
119012}
static DUCKDB_API uint32_t GetExtent(const string_t &wkb, GeometryExtent &extent)
Update the bounding box, return number of vertices processed.
Definition duckdb.cpp:119009
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetExtent() [2/2]

uint32_t duckdb::Geometry::GetExtent ( const string_t & wkb,
GeometryExtent & extent,
bool & has_any_empty )
static
119014 {
119015 BlobReader reader(wkb.GetData(), static_cast<uint32_t>(wkb.GetSize()));
119016
119017 uint32_t vertex_count = 0;
119018
119019 while (!reader.IsAtEnd()) {
119020 const auto byte_order = reader.Read<uint8_t>();
119021 if (byte_order != 1) {
119022 throw InvalidInputException("Unsupported byte order %d in WKB", byte_order);
119023 }
119024 const auto meta = reader.Read<uint32_t>();
119025 const auto type_id = (meta & 0x0000FFFF) % 1000;
119026 const auto flag_id = (meta & 0x0000FFFF) / 1000;
119027 if (type_id < 1 || type_id > 7) {
119028 throw InvalidInputException("Unsupported geometry type %d in WKB", type_id);
119029 }
119030 if (flag_id > 3) {
119031 throw InvalidInputException("Unsupported geometry flag %d in WKB", flag_id);
119032 }
119033 const auto geom_type = static_cast<GeometryType>(type_id);
119034 const auto vert_type = static_cast<VertexType>(flag_id);
119035
119036 switch (geom_type) {
119037 case GeometryType::POINT: {
119038 const auto parsed_count = ParseVertices(reader, extent, 1, vert_type, true);
119039 if (parsed_count == 0) {
119040 has_any_empty = true;
119041 continue;
119042 }
119043 vertex_count += parsed_count;
119044 } break;
119045 case GeometryType::LINESTRING: {
119046 const auto vert_count = reader.Read<uint32_t>();
119047 if (vert_count == 0) {
119048 has_any_empty = true;
119049 continue;
119050 }
119051 vertex_count += ParseVertices(reader, extent, vert_count, vert_type, false);
119052 } break;
119053 case GeometryType::POLYGON: {
119054 const auto ring_count = reader.Read<uint32_t>();
119055 if (ring_count == 0) {
119056 has_any_empty = true;
119057 continue;
119058 }
119059 for (uint32_t ring_idx = 0; ring_idx < ring_count; ring_idx++) {
119060 const auto vert_count = reader.Read<uint32_t>();
119061 if (vert_count == 0) {
119062 has_any_empty = true;
119063 continue;
119064 }
119065 vertex_count += ParseVertices(reader, extent, vert_count, vert_type, false);
119066 }
119067 } break;
119068 case GeometryType::MULTIPOINT:
119069 case GeometryType::MULTILINESTRING:
119070 case GeometryType::MULTIPOLYGON:
119071 case GeometryType::GEOMETRYCOLLECTION: {
119072 const auto part_count = reader.Read<uint32_t>();
119073 if (part_count == 0) {
119074 has_any_empty = true;
119075 }
119076 } break;
119077 default:
119078 throw InvalidInputException("Unsupported geometry type %d in WKB", static_cast<int>(geom_type));
119079 }
119080 }
119081 return vertex_count;
119082}

◆ ToVectorizedFormat() [1/2]

void duckdb::Geometry::ToVectorizedFormat ( Vector & source,
Vector & target,
idx_t count,
GeometryType geom_type,
VertexType vert_type )
static

Convert to vectorized format.

120004 {
120005 switch (vert_type) {
120006 case VertexType::XY:
120007 ToVectorizedFormatInternal<VertexXY>(source, target, count, geom_type);
120008 break;
120009 case VertexType::XYZ:
120010 ToVectorizedFormatInternal<VertexXYZ>(source, target, count, geom_type);
120011 break;
120012 case VertexType::XYM:
120013 ToVectorizedFormatInternal<VertexXYM>(source, target, count, geom_type);
120014 break;
120015 case VertexType::XYZM:
120016 ToVectorizedFormatInternal<VertexXYZM>(source, target, count, geom_type);
120017 break;
120018 default:
120019 throw InvalidInputException("Unsupported vertex type %d", static_cast<int>(vert_type));
120020 }
120021}

◆ ToVectorizedFormat() [2/2]

void duckdb::Geometry::ToVectorizedFormat ( Vector & source,
Vector & target,
idx_t count,
GeometryStorageType type )
static
120708 {
120709 if (type == GeometryStorageType::SPATIAL) {
120710 ToSpatialGeometry(source, target, count);
120711 return;
120712 }
120713
120714 const auto types = GetSpecializedType(type);
120715 ToVectorizedFormat(source, target, count, types.first, types.second);
120716}
static DUCKDB_API void ToVectorizedFormat(Vector &source, Vector &target, idx_t count, GeometryType geom_type, VertexType vert_type)
Convert to vectorized format.
Definition duckdb.cpp:120003

◆ FromVectorizedFormat() [1/2]

void duckdb::Geometry::FromVectorizedFormat ( Vector & source,
Vector & target,
idx_t count,
GeometryType geom_type,
VertexType vert_type,
idx_t result_offset )
static

Convert from vectorized format.

120051 {
120052 switch (vert_type) {
120053 case VertexType::XY:
120054 FromVectorizedFormatInternal<VertexXY>(source, target, count, geom_type, result_offset);
120055 break;
120056 case VertexType::XYZ:
120057 FromVectorizedFormatInternal<VertexXYZ>(source, target, count, geom_type, result_offset);
120058 break;
120059 case VertexType::XYM:
120060 FromVectorizedFormatInternal<VertexXYM>(source, target, count, geom_type, result_offset);
120061 break;
120062 case VertexType::XYZM:
120063 FromVectorizedFormatInternal<VertexXYZM>(source, target, count, geom_type, result_offset);
120064 break;
120065 default:
120066 throw InvalidInputException("Unsupported vertex type %d", static_cast<int>(vert_type));
120067 }
120068}

◆ FromVectorizedFormat() [2/2]

void duckdb::Geometry::FromVectorizedFormat ( Vector & source,
Vector & target,
idx_t count,
GeometryStorageType type,
idx_t result_offset )
static
120719 {
120720 if (type == GeometryStorageType::SPATIAL) {
120721 FromSpatialGeometry(source, target, count, result_offset);
120722 return;
120723 }
120724
120725 const auto types = GetSpecializedType(type);
120726 FromVectorizedFormat(source, target, count, types.first, types.second, result_offset);
120727}
static DUCKDB_API void FromVectorizedFormat(Vector &source, Vector &target, idx_t count, GeometryType geom_type, VertexType vert_type, idx_t result_offset)
Convert from vectorized format.
Definition duckdb.cpp:120050

◆ GetVectorizedType() [1/2]

LogicalType duckdb::Geometry::GetVectorizedType ( GeometryStorageType type)
static

Get the vectorized logical type for a given geometry and vertex type.

120146 {
120147 if (type == GeometryStorageType::WKB) {
120148 return LogicalType::GEOMETRY();
120149 }
120150
120151 if (type == GeometryStorageType::SPATIAL) {
120152 return GetSpatialGeometryType();
120153 }
120154
120155 const auto types = GetSpecializedType(type);
120156
120157 return GetVectorizedType(types.first, types.second);
120158}
static LogicalType GetSpatialGeometryType()
Get legacy geometry type (pre v1.5).
Definition duckdb.cpp:120729
static DUCKDB_API LogicalType GetVectorizedType(GeometryStorageType type)
Get the vectorized logical type for a given geometry and vertex type.
Definition duckdb.cpp:120146
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetVectorizedType() [2/2]

LogicalType duckdb::Geometry::GetVectorizedType ( GeometryType geom_type,
VertexType vert_type )
static
120160 {
120161 switch (vert_type) {
120162 case VertexType::XY: {
120163 auto vert = LogicalType::STRUCT({{"x", LogicalType::DOUBLE}, {"y", LogicalType::DOUBLE}});
120164 return GetVectorizedTypeInternal(geom_type, std::move(vert));
120165 }
120166 case VertexType::XYZ: {
120167 auto vert =
120168 LogicalType::STRUCT({{"x", LogicalType::DOUBLE}, {"y", LogicalType::DOUBLE}, {"z", LogicalType::DOUBLE}});
120169 return GetVectorizedTypeInternal(geom_type, std::move(vert));
120170 }
120171 case VertexType::XYM: {
120172 auto vert =
120173 LogicalType::STRUCT({{"x", LogicalType::DOUBLE}, {"y", LogicalType::DOUBLE}, {"m", LogicalType::DOUBLE}});
120174 return GetVectorizedTypeInternal(geom_type, std::move(vert));
120175 }
120176 case VertexType::XYZM: {
120177 auto vert = LogicalType::STRUCT({{"x", LogicalType::DOUBLE},
120178 {"y", LogicalType::DOUBLE},
120179 {"z", LogicalType::DOUBLE},
120180 {"m", LogicalType::DOUBLE}});
120181 return GetVectorizedTypeInternal(geom_type, std::move(vert));
120182 }
120183 default:
120184 throw InvalidInputException("Unsupported vertex type %d", static_cast<int>(vert_type));
120185 }
120186}

◆ GetSpecializedType()

pair< GeometryType, VertexType > duckdb::Geometry::GetSpecializedType ( GeometryStorageType type)
static
120091 {
120092 switch (type) {
120093 case GeometryStorageType::POINT_XY:
120094 return {GeometryType::POINT, VertexType::XY};
120095 case GeometryStorageType::POINT_XYZ:
120096 return {GeometryType::POINT, VertexType::XYZ};
120097 case GeometryStorageType::POINT_XYM:
120098 return {GeometryType::POINT, VertexType::XYM};
120099 case GeometryStorageType::POINT_XYZM:
120100 return {GeometryType::POINT, VertexType::XYZM};
120101 case GeometryStorageType::LINESTRING_XY:
120102 return {GeometryType::LINESTRING, VertexType::XY};
120103 case GeometryStorageType::LINESTRING_XYZ:
120104 return {GeometryType::LINESTRING, VertexType::XYZ};
120105 case GeometryStorageType::LINESTRING_XYM:
120106 return {GeometryType::LINESTRING, VertexType::XYM};
120107 case GeometryStorageType::LINESTRING_XYZM:
120108 return {GeometryType::LINESTRING, VertexType::XYZM};
120109 case GeometryStorageType::POLYGON_XY:
120110 return {GeometryType::POLYGON, VertexType::XY};
120111 case GeometryStorageType::POLYGON_XYZ:
120112 return {GeometryType::POLYGON, VertexType::XYZ};
120113 case GeometryStorageType::POLYGON_XYM:
120114 return {GeometryType::POLYGON, VertexType::XYM};
120115 case GeometryStorageType::POLYGON_XYZM:
120116 return {GeometryType::POLYGON, VertexType::XYZM};
120117 case GeometryStorageType::MULTIPOINT_XY:
120118 return {GeometryType::MULTIPOINT, VertexType::XY};
120119 case GeometryStorageType::MULTIPOINT_XYZ:
120120 return {GeometryType::MULTIPOINT, VertexType::XYZ};
120121 case GeometryStorageType::MULTIPOINT_XYM:
120122 return {GeometryType::MULTIPOINT, VertexType::XYM};
120123 case GeometryStorageType::MULTIPOINT_XYZM:
120124 return {GeometryType::MULTIPOINT, VertexType::XYZM};
120125 case GeometryStorageType::MULTILINESTRING_XY:
120126 return {GeometryType::MULTILINESTRING, VertexType::XY};
120127 case GeometryStorageType::MULTILINESTRING_XYZ:
120128 return {GeometryType::MULTILINESTRING, VertexType::XYZ};
120129 case GeometryStorageType::MULTILINESTRING_XYM:
120130 return {GeometryType::MULTILINESTRING, VertexType::XYM};
120131 case GeometryStorageType::MULTILINESTRING_XYZM:
120132 return {GeometryType::MULTILINESTRING, VertexType::XYZM};
120133 case GeometryStorageType::MULTIPOLYGON_XY:
120134 return {GeometryType::MULTIPOLYGON, VertexType::XY};
120135 case GeometryStorageType::MULTIPOLYGON_XYZ:
120136 return {GeometryType::MULTIPOLYGON, VertexType::XYZ};
120137 case GeometryStorageType::MULTIPOLYGON_XYM:
120138 return {GeometryType::MULTIPOLYGON, VertexType::XYM};
120139 case GeometryStorageType::MULTIPOLYGON_XYZM:
120140 return {GeometryType::MULTIPOLYGON, VertexType::XYZM};
120141 default:
120142 throw InvalidInputException("Unsupported GeometryStorageType %d", static_cast<int>(type));
120143 }
120144}

◆ FromSpatialGeometry() [1/3]

void duckdb::Geometry::FromSpatialGeometry ( const string_t & source,
string_t & target,
Vector & vector )
static
120341 {
120342 BlobReader reader(source.GetData(), static_cast<uint32_t>(source.GetSize()));
120343 const auto required_size = FromLegacyGeometryRequiredSize(reader);
120344
120345 reader.Reset();
120346
120347 auto blob = StringVector::EmptyString(vector, required_size);
120348 const auto blob_data = blob.GetDataWriteable();
120349 FixedSizeBlobWriter writer(blob_data, required_size);
120350
120351 FromLegacyGeometryConversion(reader, writer);
120352
120353 blob.Finalize();
120354 target = blob;
120355}

◆ FromSpatialGeometry() [2/3]

void duckdb::Geometry::FromSpatialGeometry ( Vector & source,
Vector & target,
idx_t count,
idx_t result_offset )
static
120357 {
120358 UnifiedVectorFormat source_format;
120359 source_vec.ToUnifiedFormat(count, source_format);
120360
120361 const auto source_data = UnifiedVectorFormat::GetData<string_t>(source_format);
120362 const auto target_data = FlatVector::GetData<string_t>(target_vec);
120363
120364 auto &target_mask = FlatVector::Validity(target_vec);
120365
120366 for (idx_t row_idx = 0; row_idx < count; row_idx++) {
120367 const auto src_idx = source_format.sel->get_index(row_idx);
120368 const auto res_idx = result_offset + row_idx;
120369
120370 if (!source_format.validity.RowIsValid(src_idx)) {
120371 target_mask.EnsureWritable();
120372 target_mask.SetInvalid(res_idx);
120373 continue;
120374 }
120375
120376 const auto &source = source_data[src_idx];
120377 BlobReader reader(source.GetData(), static_cast<uint32_t>(source.GetSize()));
120378 const auto required_size = FromLegacyGeometryRequiredSize(reader);
120379
120380 reader.Reset();
120381
120382 auto blob = StringVector::EmptyString(target_vec, required_size);
120383 const auto blob_data = blob.GetDataWriteable();
120384 FixedSizeBlobWriter writer(blob_data, required_size);
120385
120386 FromLegacyGeometryConversion(reader, writer);
120387 blob.Finalize();
120388 target_data[res_idx] = blob;
120389 }
120390}

◆ FromSpatialGeometry() [3/3]

void duckdb::Geometry::FromSpatialGeometry ( const string_t & source,
string & target )
static
120392 {
120393 BlobReader reader(source.GetData(), static_cast<uint32_t>(source.GetSize()));
120394 const auto required_size = FromLegacyGeometryRequiredSize(reader);
120395
120396 reader.Reset();
120397
120398 target.resize(required_size);
120399 FixedSizeBlobWriter writer(&target[0], required_size);
120400
120401 FromLegacyGeometryConversion(reader, writer);
120402}

◆ ToSpatialGeometry() [1/3]

void duckdb::Geometry::ToSpatialGeometry ( const string_t & source,
string_t & target,
Vector & vector )
static
120668 {
120669 ToSpatialGeometryState state;
120670 state.reader = BlobReader(source.GetData(), static_cast<uint32_t>(source.GetSize()));
120671
120672 ToSpatialGeometryAnalyze(state);
120673
120674 state.reader.Reset();
120675
120676 auto blob = StringVector::EmptyString(vector, state.required_size);
120677 const auto blob_data = blob.GetDataWriteable();
120678 FixedSizeBlobWriter writer(blob_data, state.required_size);
120679
120680 ToSpatialGeometryConvert(state, writer);
120681
120682 blob.Finalize();
120683 target = blob;
120684}

◆ ToSpatialGeometry() [2/3]

void duckdb::Geometry::ToSpatialGeometry ( Vector & source,
Vector & target,
idx_t count )
static
120686 {
120687 UnaryExecutor::Execute<string_t, string_t>(source, target, count, [&](const string_t &source) {
120688 string_t result;
120689 ToSpatialGeometry(source, result, target);
120690 return result;
120691 });
120692}

◆ ToSpatialGeometry() [3/3]

void duckdb::Geometry::ToSpatialGeometry ( const string_t & source,
string & target )
static
120694 {
120695 ToSpatialGeometryState state;
120696 state.reader = BlobReader(source.GetData(), static_cast<uint32_t>(source.GetSize()));
120697
120698 ToSpatialGeometryAnalyze(state);
120699
120700 state.reader.Reset();
120701
120702 target.resize(state.required_size);
120703 FixedSizeBlobWriter writer(&target[0], state.required_size);
120704
120705 ToSpatialGeometryConvert(state, writer);
120706}

The documentation for this class was generated from the following files: