Skip to content

Commit 2d2cc45

Browse files
authored
Merge pull request #628 from szarnyasg/formatting-fixes
Formatting fixes for SQL examples
2 parents c5744ee + 3be5623 commit 2d2cc45

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

src/spatial/modules/main/spatial_functions_scalar.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ struct ST_Area {
524524
)";
525525

526526
static constexpr const char *EXAMPLE = R"(
527-
select ST_Area('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))'::geometry);
527+
SELECT ST_Area('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))'::GEOMETRY);
528528
-- 1.0
529529
)";
530530

@@ -850,20 +850,20 @@ struct ST_AsGeoJSON {
850850
)";
851851

852852
static constexpr auto EXAMPLE = R"(
853-
select ST_AsGeoJSON('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))'::geometry);
853+
SELECT ST_AsGeoJSON('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))'::GEOMETRY);
854854
----
855-
{"type":"Polygon","coordinates":[[[0.0,0.0],[0.0,1.0],[1.0,1.0],[1.0,0.0],[0.0,0.0]]]}
855+
{"type":"Polygon","coordinates":[[[0.0, 0.0], [0.0, 1.0], [1.0, 1.0], [1.0, 0.0], [0.0, 0.0]]]}
856856
857857
-- Convert a geometry into a full GeoJSON feature (requires the JSON extension to be loaded)
858858
SELECT CAST({
859859
type: 'Feature',
860-
geometry: ST_AsGeoJSON(ST_Point(1,2)),
860+
geometry: ST_AsGeoJSON(ST_Point(1, 2)),
861861
properties: {
862862
name: 'my_point'
863863
}
864864
} AS JSON);
865865
----
866-
{"type":"Feature","geometry":{"type":"Point","coordinates":[1.0,2.0]},"properties":{"name":"my_point"}}
866+
{"type":"Feature","geometry":{"type":"Point","coordinates":[1.0, 2.0]},"properties":{"name":"my_point"}}
867867
)";
868868

869869
//------------------------------------------------------------------------------------------------------------------
@@ -955,7 +955,7 @@ struct ST_AsText {
955955
)";
956956

957957
static constexpr const char *EXAMPLE = R"(
958-
SELECT ST_MakeEnvelope(0,0,1,1);
958+
SELECT ST_MakeEnvelope(0, 0, 1, 1);
959959
----
960960
POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))
961961
)";
@@ -1096,7 +1096,7 @@ struct ST_AsHEXWKB {
10961096
)";
10971097

10981098
static constexpr const char *EXAMPLE = R"(
1099-
SELECT ST_AsHexWKB('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))'::geometry);
1099+
SELECT ST_AsHexWKB('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))'::GEOMETRY);
11001100
----
11011101
01030000000100000005000000000000000000000000000...
11021102
)";
@@ -1975,7 +1975,7 @@ struct ST_CollectionExtract {
19751975
)";
19761976

19771977
static constexpr auto EXAMPLE = R"(
1978-
select st_collectionextract('MULTIPOINT(1 2,3 4)'::geometry, 1);
1978+
SELECT ST_CollectionExtract('MULTIPOINT(1 2, 3 4)'::GEOMETRY, 1);
19791979
-- MULTIPOINT (1 2, 3 4)
19801980
)";
19811981

@@ -2204,7 +2204,7 @@ struct ST_Dimension {
22042204
)";
22052205

22062206
static constexpr auto EXAMPLE = R"(
2207-
select st_dimension('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))'::geometry);
2207+
SELECT ST_Dimension('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))'::GEOMETRY);
22082208
----
22092209
2
22102210
)";
@@ -2960,15 +2960,15 @@ struct ST_Dump {
29602960
static constexpr auto DESCRIPTION = R"(
29612961
Dumps a geometry into a list of sub-geometries and their "path" in the original geometry.
29622962
2963-
You can use the `UNNEST(res, recursive := true)` function to explode resulting list of structs into multiple rows.
2963+
You can use the `unnest(res, recursive := true)` function to explode the resulting list of structs into multiple rows.
29642964
)";
29652965

29662966
static constexpr auto EXAMPLE = R"(
2967-
select st_dump('MULTIPOINT(1 2,3 4)'::geometry);
2967+
SELECT ST_Dump('MULTIPOINT(1 2, 3 4)'::GEOMETRY);
29682968
----
29692969
[{'geom': 'POINT(1 2)', 'path': [0]}, {'geom': 'POINT(3 4)', 'path': [1]}]
29702970
2971-
select unnest(st_dump('MULTIPOINT(1 2,3 4)'::geometry), recursive := true);
2971+
SELECT unnest(ST_Dump('MULTIPOINT(1 2, 3 4)'::GEOMETRY), recursive := true);
29722972
-- ┌─────────────┬─────────┐
29732973
-- │ geom │ path │
29742974
-- │ geometry │ int32[] │
@@ -4554,7 +4554,7 @@ struct ST_GeomFromGeoJSON {
45544554
)";
45554555

45564556
static constexpr auto EXAMPLE = R"(
4557-
SELECT ST_GeomFromGeoJSON('{"type":"Point","coordinates":[1.0,2.0]}');
4557+
SELECT ST_GeomFromGeoJSON('{"type": "Point", "coordinates": [1.0, 2.0]}');
45584558
----
45594559
POINT (1 2)
45604560
)";
@@ -7592,11 +7592,11 @@ struct ST_Points {
75927592
)";
75937593

75947594
static constexpr auto EXAMPLE = R"(
7595-
select st_points('LINESTRING(1 1, 2 2)'::geometry);
7595+
SELECT ST_Points('LINESTRING(1 1, 2 2)'::GEOMETRY);
75967596
----
75977597
MULTIPOINT (1 1, 2 2)
75987598
7599-
select st_points('MULTIPOLYGON Z EMPTY'::geometry);
7599+
SELECT ST_Points('MULTIPOLYGON Z EMPTY'::GEOMETRY);
76007600
----
76017601
MULTIPOINT Z EMPTY
76027602
)";
@@ -7724,7 +7724,7 @@ struct ST_QuadKey {
77247724
)";
77257725

77267726
static constexpr auto EXAMPLE = R"(
7727-
SELECT ST_QuadKey(st_point(11.08, 49.45), 10);
7727+
SELECT ST_QuadKey(ST_Point(11.08, 49.45), 10);
77287728
----
77297729
1333203202
77307730
)";

src/spatial/modules/osm/osm_module.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ static unique_ptr<TableRef> ReadOsmPBFReplacementScan(ClientContext &context, Re
860860
// static constexpr DocTag DOC_TAGS[] = {{"ext", "spatial"}};
861861

862862
static constexpr const char *DOC_DESCRIPTION = R"(
863-
The `ST_ReadOsm()` table function enables reading compressed OpenStreetMap data directly from a `.osm.pbf file.`
863+
The `ST_ReadOsm()` table function enables reading compressed OpenStreetMap data directly from a `.osm.pbf` file.
864864
865865
This function uses multithreading and zero-copy protobuf parsing which makes it a lot faster than using the `ST_Read()` OSM driver, however it only outputs the raw OSM data (Nodes, Ways, Relations), without constructing any geometries. For simple node entities (like PoI's) you can trivially construct POINT geometries, but it is also possible to construct LINESTRING and POLYGON geometries by manually joining refs and nodes together in SQL, although with available memory usually being a limiting factor.
866866
The `ST_ReadOSM()` function also provides a "replacement scan" to enable reading from a file directly as if it were a table. This is just syntax sugar for calling `ST_ReadOSM()` though. Example:

0 commit comments

Comments
 (0)