Skip to content

Commit d5ee3ec

Browse files
committed
format
1 parent c483dd5 commit d5ee3ec

File tree

4 files changed

+44
-43
lines changed

4 files changed

+44
-43
lines changed

spatial/src/spatial/core/functions/scalar/st_extent.cpp

+15-15
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "spatial/core/geometry/geometry.hpp"
88
#include "spatial/core/types.hpp"
99

10-
1110
namespace spatial {
1211

1312
namespace core {
@@ -26,8 +25,9 @@ static uint32_t ReadInt(const bool le, Cursor &cursor) {
2625
}
2726
static void ReadWKB(Cursor &cursor, BoundingBox &bbox);
2827

29-
static void ReadWKB(const bool le, const uint32_t type, const bool has_z, const bool has_m, Cursor &cursor, BoundingBox &bbox) {
30-
switch(type) {
28+
static void ReadWKB(const bool le, const uint32_t type, const bool has_z, const bool has_m, Cursor &cursor,
29+
BoundingBox &bbox) {
30+
switch (type) {
3131
case 1: { // POINT
3232
// Points are special in that they can be all-nan (empty)
3333
bool all_nan = true;
@@ -44,41 +44,41 @@ static void ReadWKB(const bool le, const uint32_t type, const bool has_z, const
4444
} break;
4545
case 2: { // LINESTRING
4646
const auto num_verts = ReadInt(le, cursor);
47-
for(uint32_t i = 0; i < num_verts; i++) {
47+
for (uint32_t i = 0; i < num_verts; i++) {
4848
const auto x = ReadDouble(le, cursor);
4949
const auto y = ReadDouble(le, cursor);
50-
if(has_z) {
50+
if (has_z) {
5151
ReadDouble(le, cursor);
5252
}
53-
if(has_m) {
53+
if (has_m) {
5454
ReadDouble(le, cursor);
5555
}
5656
bbox.Stretch(x, y);
5757
}
5858
} break;
5959
case 3: { // POLYGON
6060
const auto num_rings = ReadInt(le, cursor);
61-
for(uint32_t i = 0; i < num_rings; i++) {
61+
for (uint32_t i = 0; i < num_rings; i++) {
6262
const auto num_verts = ReadInt(le, cursor);
63-
for(uint32_t j = 0; j < num_verts; j++) {
63+
for (uint32_t j = 0; j < num_verts; j++) {
6464
const auto x = ReadDouble(le, cursor);
6565
const auto y = ReadDouble(le, cursor);
66-
if(has_z) {
66+
if (has_z) {
6767
ReadDouble(le, cursor);
6868
}
69-
if(has_m) {
69+
if (has_m) {
7070
ReadDouble(le, cursor);
7171
}
7272
bbox.Stretch(x, y);
7373
}
7474
}
7575
} break;
76-
case 4: // MULTIPOINT
77-
case 5: // MULTILINESTRING
78-
case 6: // MULTIPOLYGON
76+
case 4: // MULTIPOINT
77+
case 5: // MULTILINESTRING
78+
case 6: // MULTIPOLYGON
7979
case 7: { // GEOMETRYCOLLECTION
8080
const auto num_items = ReadInt(le, cursor);
81-
for(uint32_t i = 0; i < num_items; i++) {
81+
for (uint32_t i = 0; i < num_items; i++) {
8282
ReadWKB(cursor, bbox);
8383
}
8484
} break;
@@ -98,7 +98,7 @@ static void ReadWKB(Cursor &cursor, BoundingBox &bbox) {
9898

9999
// Skip SRID if present
100100
const auto has_srid = (type & 0x20000000) != 0;
101-
if(has_srid) {
101+
if (has_srid) {
102102
cursor.Skip(sizeof(uint32_t));
103103
}
104104

spatial/src/spatial/core/functions/scalar/st_geometrytype.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ static void GeometryTypeFunction(DataChunk &args, ExpressionState &state, Vector
5555
auto &input = args.data[0];
5656

5757
UnaryExecutor::Execute<geometry_t, uint8_t>(
58-
input, result, count, [&](const geometry_t &geom) {
59-
return static_cast<uint8_t>(geom.GetType());
60-
});
58+
input, result, count, [&](const geometry_t &geom) { return static_cast<uint8_t>(geom.GetType()); });
6159
}
6260

6361
//------------------------------------------------------------------------------
@@ -72,7 +70,7 @@ static void WKBTypeFunction(DataChunk &args, ExpressionState &state, Vector &res
7270
const auto le = cursor.Read<uint8_t>();
7371
const auto type = le ? cursor.Read<uint32_t>() : cursor.ReadBigEndian<uint32_t>();
7472
const auto normalized_type = (type & 0xffff) % 1000;
75-
if(normalized_type == 0 || normalized_type > 7) {
73+
if (normalized_type == 0 || normalized_type > 7) {
7674
throw InvalidInputException("WKB type '%d' is not a supported geometry type", type);
7775
}
7876

@@ -108,7 +106,7 @@ void CoreScalarFunctions::RegisterStGeometryType(DatabaseInstance &db) {
108106
ScalarFunction({GeoTypes::GEOMETRY()}, LogicalType::ANY, GeometryTypeFunction, GeometryTypeFunctionBind));
109107

110108
geometry_type_set.AddFunction(
111-
ScalarFunction({GeoTypes::WKB_BLOB()}, LogicalType::ANY, WKBTypeFunction, GeometryTypeFunctionBind));
109+
ScalarFunction({GeoTypes::WKB_BLOB()}, LogicalType::ANY, WKBTypeFunction, GeometryTypeFunctionBind));
112110

113111
ExtensionUtil::RegisterFunction(db, geometry_type_set);
114112
DocUtil::AddDocumentation(db, "ST_GeometryType", DOC_DESCRIPTION, DOC_EXAMPLE, DOC_TAGS);

spatial/src/spatial/core/functions/scalar/st_has.cpp

+24-21
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,15 @@ static void GeometryZMFlagFunction(DataChunk &args, ExpressionState &state, Vect
3131
const auto has_z = props.HasZ();
3232
const auto has_m = props.HasM();
3333

34-
if(has_z && has_m) { return 3; }
35-
if(has_z) { return 2; }
36-
if(has_m) { return 1; }
34+
if (has_z && has_m) {
35+
return 3;
36+
}
37+
if (has_z) {
38+
return 2;
39+
}
40+
if (has_m) {
41+
return 1;
42+
}
3743
return 0;
3844
});
3945
}
@@ -68,9 +74,15 @@ static void WKBZMFlagFunction(DataChunk &args, ExpressionState &state, Vector &r
6874
const auto has_z = (iso_wkb_props == 1) || (iso_wkb_props == 3) || ((type & 0x80000000) != 0);
6975
const auto has_m = (iso_wkb_props == 2) || (iso_wkb_props == 3) || ((type & 0x40000000) != 0);
7076

71-
if(has_z && has_m) { return 3; }
72-
if(has_z) { return 2; }
73-
if(has_m) { return 1; }
77+
if (has_z && has_m) {
78+
return 3;
79+
}
80+
if (has_z) {
81+
return 2;
82+
}
83+
if (has_m) {
84+
return 1;
85+
}
7486
return 0;
7587
});
7688
}
@@ -170,25 +182,16 @@ static constexpr const char *ZMFLAG_EXAMPLE = R"(
170182
//------------------------------------------------------------------------------
171183
void CoreScalarFunctions::RegisterStHas(DatabaseInstance &db) {
172184
ScalarFunctionSet st_hasz("ST_HasZ");
173-
st_hasz.AddFunction(ScalarFunction({GeoTypes::GEOMETRY()}, LogicalType::BOOLEAN,
174-
GeometryHasFunction<true>));
175-
st_hasz.AddFunction(ScalarFunction({GeoTypes::WKB_BLOB()}, LogicalType::BOOLEAN,
176-
WKBHasFunction<true>));
177-
185+
st_hasz.AddFunction(ScalarFunction({GeoTypes::GEOMETRY()}, LogicalType::BOOLEAN, GeometryHasFunction<true>));
186+
st_hasz.AddFunction(ScalarFunction({GeoTypes::WKB_BLOB()}, LogicalType::BOOLEAN, WKBHasFunction<true>));
178187

179188
ScalarFunctionSet st_hasm("ST_HasM");
180-
st_hasm.AddFunction(ScalarFunction({GeoTypes::GEOMETRY()}, LogicalType::BOOLEAN,
181-
GeometryHasFunction<false>));
182-
st_hasm.AddFunction(ScalarFunction({GeoTypes::WKB_BLOB()}, LogicalType::BOOLEAN,
183-
WKBHasFunction<false>));
184-
189+
st_hasm.AddFunction(ScalarFunction({GeoTypes::GEOMETRY()}, LogicalType::BOOLEAN, GeometryHasFunction<false>));
190+
st_hasm.AddFunction(ScalarFunction({GeoTypes::WKB_BLOB()}, LogicalType::BOOLEAN, WKBHasFunction<false>));
185191

186192
ScalarFunctionSet st_zmflag("ST_ZMFlag");
187-
st_zmflag.AddFunction(ScalarFunction({GeoTypes::GEOMETRY()}, LogicalType::UTINYINT,
188-
GeometryZMFlagFunction));
189-
st_zmflag.AddFunction(ScalarFunction({GeoTypes::WKB_BLOB()}, LogicalType::UTINYINT,
190-
WKBZMFlagFunction));
191-
193+
st_zmflag.AddFunction(ScalarFunction({GeoTypes::GEOMETRY()}, LogicalType::UTINYINT, GeometryZMFlagFunction));
194+
st_zmflag.AddFunction(ScalarFunction({GeoTypes::WKB_BLOB()}, LogicalType::UTINYINT, WKBZMFlagFunction));
192195

193196
ExtensionUtil::RegisterFunction(db, st_hasz);
194197
ExtensionUtil::RegisterFunction(db, st_hasm);

spatial/src/spatial/core/io/shapefile/read_shapefile.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ struct ShapefileBindData : TableFunctionData {
3737
vector<LogicalType> attribute_types;
3838

3939
explicit ShapefileBindData(string file_name_p)
40-
: file_name(std::move(file_name_p)), shape_count(0), shape_type(0), min_bound {0, 0, 0, 0},
41-
max_bound {0, 0, 0, 0}, attribute_encoding(AttributeEncoding::LATIN1) {
40+
: file_name(std::move(file_name_p)), shape_count(0),
41+
shape_type(0), min_bound {0, 0, 0, 0}, max_bound {0, 0, 0, 0}, attribute_encoding(AttributeEncoding::LATIN1) {
4242
}
4343
};
4444

0 commit comments

Comments
 (0)