- Notifications
You must be signed in to change notification settings - Fork15
[ISSUE #16] Implemented a function and tests to extract vertices from spoly by index#37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
psql:pg_sphere.test.sql:9207: NOTICE: return type smoc is only a shell | ||
psql:pg_sphere.test.sql:9213: NOTICE: argument type smoc is only a shell |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -603,3 +603,10 @@ SELECT npoints( spoly '{ | ||
(1.5121581120647 , -1.93925472462553e-05), | ||
(1.51214841579108 , -1.93925472462553e-05) | ||
}'); | ||
SELECT set_sphere_output( 'RAD' ); | ||
SELECT spoint( spoly '{(0,0),(1,0),(1,1)}', 1 ); | ||
SELECT spoint( spoly '{(0,0),(1,0),(1,1)}', 2 ); | ||
SELECT spoint( spoly '{(0,0),(1,0),(1,1)}', 3 ); | ||
SELECT spoly_as_array( spoly '{(0,0),(1,0),(1,1)}' ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I hate to nitpick whitespace, but I recommend removing one of the two spaces after the SELECTs on lines 599, 601, 603, and 605. Otherwise, it looks good to me! But if you're adding a function, shouldn't there be an upgrade script and version number bump? Or will that be done in a separate PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Of course, but which version should we put?@vitcpp There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. As we discussed before, the master branch is the development branch. Once the API is changed I propose to assign a new version 1.3.0. Upgrade script should be named as pg_sphere--1.2.3--1.3.0.sql.in. The same as I proposed in#22. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Concerning the use of blank lines for queries separation. I propose to follow the same coding style. There are no blank lines in sql/path.sql but there are blank lines in sql/poly.sql. I propose to remove these redundant blank lines. Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
#include "path.h" | ||
#include "point.h" | ||
#include <catalog/namespace.h> | ||
/* | ||
* Path functions | ||
@@ -50,6 +52,7 @@ PG_FUNCTION_INFO_V1(spheretrans_path); | ||
PG_FUNCTION_INFO_V1(spheretrans_path_inverse); | ||
PG_FUNCTION_INFO_V1(spherepath_add_point); | ||
PG_FUNCTION_INFO_V1(spherepath_add_points_finalize); | ||
PG_FUNCTION_INFO_V1(spherepath_get_array); | ||
/* | ||
@@ -555,6 +558,30 @@ spherepath_get_point(PG_FUNCTION_ARGS) | ||
PG_RETURN_NULL(); | ||
} | ||
Datum | ||
spherepath_get_array(PG_FUNCTION_ARGS) | ||
{ | ||
SPATH *path = PG_GETARG_SPATH(0); | ||
Datum *datum_arr = (Datum *) palloc(sizeof(Datum) * path->npts); | ||
ArrayType *res; | ||
SPoint *p = (SPoint *) palloc(sizeof(SPoint) * path->npts); | ||
for (size_t i = 0; i < path->npts; i++) | ||
dura0ok marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
{ | ||
if (!spath_get_point(&p[i], path, i)) | ||
{ | ||
pfree(p); | ||
pfree(datum_arr); | ||
PG_RETURN_NULL(); | ||
} | ||
datum_arr[i] = PointerGetDatum(&p[i]); | ||
} | ||
res = construct_array(datum_arr, path->npts, get_spoint_type_oid(), sizeof(SPoint), false, 'd'); | ||
PG_RETURN_ARRAYTYPE_P(res); | ||
} | ||
Datum | ||
spherepath_point(PG_FUNCTION_ARGS) | ||
{ | ||
Uh oh!
There was an error while loading.Please reload this page.