builtins: add Geography builtins#48529
Conversation
|
❌ The GitHub CI (Cockroach) build has failed on d0762da0. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
bf46bd9 to
8488ecc
Compare
sumeerbhola
left a comment
There was a problem hiding this comment.
Reviewed 10 of 10 files at r1.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @otan)
docs/generated/sql/functions.md, line 668 at r1 (raw file):
<tbody> <tr><td><a name="st_area"></a><code>st_area(geography: geography) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the area of the given geography in meters^2. Uses a spheroid to perform the operation.</p> <p>This function utilizes the S2 library for spherical calculations.</p>
shouldn't this say "utilizes the GeographicLib library for spheroid calculations"?
docs/generated/sql/functions.md, line 748 at r1 (raw file):
<tr><td><a name="st_dwithin"></a><code>st_dwithin(geography_a: geography, geography_b: geography, distance: <a href="float.html">float</a>) → <a href="bool.html">bool</a></code></td><td><span class="funcdesc"><p>Returns true if any of geography_a is within distance meters of geography_b. Uses a spheroid to perform the operation.</p> <p>The calculations performed are have a precision of 1cm.</p> <p>This function utilizes the GeographicLib library for spheroid calculations.</p>
this should also say that it uses S2 for finding the closest points on the sphere.
docs/generated/sql/functions.md, line 820 at r1 (raw file):
</span></td></tr> <tr><td><a name="st_length"></a><code>st_length(geography: geography) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the length of the given geography in meters. Uses a spheroid to perform the operation.</p> <p>This function utilizes the S2 library for spherical calculations.</p>
shouldn't this be "utilizes the GeographicLib library for spheroid calculations"
docs/generated/sql/functions.md, line 915 at r1 (raw file):
</span></td></tr> <tr><td><a name="st_perimeter"></a><code>st_perimeter(geography: geography) → <a href="float.html">float</a></code></td><td><span class="funcdesc"><p>Returns the perimeter of the given geography in meters. Uses a spheroid to perform the operation.</p> <p>This function utilizes the S2 library for spherical calculations.</p>
ditto
pkg/sql/sem/builtins/geo_builtins.go, line 53 at r1 (raw file):
ib.libraryUsage&usesGEOS
Does go fmt remove the space around the &? If not, I'd prefer to have that space since it makes it easier to spot the operator.
otan
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @sumeerbhola)
docs/generated/sql/functions.md, line 668 at r1 (raw file):
Previously, sumeerbhola wrote…
shouldn't this say "utilizes the GeographicLib library for spheroid calculations"?
Done.
docs/generated/sql/functions.md, line 748 at r1 (raw file):
Previously, sumeerbhola wrote…
this should also say that it uses S2 for finding the closest points on the sphere.
Done.
docs/generated/sql/functions.md, line 820 at r1 (raw file):
Previously, sumeerbhola wrote…
shouldn't this be "utilizes the GeographicLib library for spheroid calculations"
Done.
docs/generated/sql/functions.md, line 915 at r1 (raw file):
Done.
Done.
pkg/sql/sem/builtins/geo_builtins.go, line 53 at r1 (raw file):
Previously, sumeerbhola wrote…
ib.libraryUsage&usesGEOSDoes
go fmtremove the space around the&? If not, I'd prefer to have that space since it makes it easier to spot the operator.
yeah this is a gofmt thing.
227271e to
4bd92dc
Compare
sumeerbhola
left a comment
There was a problem hiding this comment.
Reviewed 6 of 6 files at r2.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @otan and @sumeerbhola)
pkg/sql/sem/builtins/geo_builtins.go, line 38 at r2 (raw file):
const usesSpheroidMessage = " Uses a spheroid to perform the operation." const spheroidDistanceMessage = `"\n\nWhen operating on a spheroid, this function will use the sphere to calculate ` + `the closest two points using S2. The spheroid distance is calculated of these two points using GeographicLib. ` +
nit: The spheroid distance between these two points is calculated using GeographicLib
(simpler sentence structure)
otan
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @sumeerbhola)
pkg/sql/sem/builtins/geo_builtins.go, line 38 at r2 (raw file):
Previously, sumeerbhola wrote…
nit: The spheroid distance between these two points is calculated using GeographicLib
(simpler sentence structure)
Done.
|
bors r=sumeerbhola |
Build failed (retrying...) |
|
❌ The GitHub CI (Cockroach) build has failed on c28bcd2d. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
Fruits of labour be released to the public! Added some more helpers for InfoBuilder to include the source library in which our calculations are done. Release note (sql change): We introduce the following newly implemented functions that work on GEOGRAPHY types: * ST_Covers * ST_CoveredBy * ST_Intersects * ST_Distance * ST_DWithin * ST_Perimeter * ST_Area * ST_Length
Canceled |
|
bors r=sumeerbhola |
Build succeeded |
Fruits of labour be released to the public!
Added some more helpers for InfoBuilder to include the source library in
which our calculations are done.
Resolves #48367
Resolves #48393
Resolves #48394
Resolves #48395
Resolves #48396
Resolves #48399
Resolves #48400
Resolves #48401
Release note (sql change): We introduce the following newly implemented
functions that work on GEOGRAPHY types: