Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

KNN support for spoints#116

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

Merged
vitcpp merged 2 commits intopostgrespro:masterfromvitcpp:knn
Dec 22, 2023
Merged

KNN support for spoints#116

vitcpp merged 2 commits intopostgrespro:masterfromvitcpp:knn
Dec 22, 2023

Conversation

vitcpp
Copy link
Contributor

This is the original patch for review and improvement.

@@ -68,6 +68,11 @@
</para>
</listitem>
</itemizedlist>
<para>
GiST index can be used also for fast finding points closest to the given one
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Change "fast finding points" to "quickly finding the points".

<para>
GiST index can be used also for fast finding points closest to the given one
when ordering by an expression with the <literal>&lt;-&gt;</literal> operator
is used, as shown in an example below.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Remove "is used" and move the comma to be at the end of "operator" on the previous line.

@@ -100,7 +112,6 @@
<![CDATA[CREATE INDEX test_pos_idx USING BRIN ON test (pos) WITH (pages_per_range = 16);]]>
</programlisting>
</example>

Copy link
Contributor

@esabolesabolDec 12, 2023
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Based on the other</sect1> tags I saw, I don't think this blank line before</sect1> should have been removed.

CREATE FUNCTION g_spoint_consistent(internal, internal, int4, oid, internal)
RETURNS internal
AS 'MODULE_PATHNAME', 'g_spoint_consistent'
LANGUAGE 'c';

CREATE FUNCTION g_spoint_distance(internal, spoint, smallint, oid, internal)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Create an upgrade script and add this function to it.

@@ -114,6 +117,7 @@ CREATE OPERATOR CLASS spoint
OPERATOR 14 @ (spoint, spoly),
OPERATOR 15 @ (spoint, sellipse),
OPERATOR 16 @ (spoint, sbox),
OPERATOR 17<-> (spoint, spoint) FOR ORDER BY float_ops,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Whitespace doesn't match the otherOPERATOR lines surrounding this addition. The17 should line up with the16 on the previous line for starters.

src/gist.c Outdated
@@ -681,6 +682,10 @@ g_spoint3_consistent(PG_FUNCTION_ARGS)
PG_RETURN_BOOL(false);
}

static double distance_vector_point_3d (Vector3D* v, double x, double y, double z) {
return acos ( (v->x * x + v->y * y + v->z * z) / sqrt( x*x + y*y + z*z ) ); // as v has length=1 by design
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Remove the space afteracos.

src/gist.c Outdated
v_high.y = (double)box->high.coord[1] / MAXCVALUE;
v_high.z = (double)box->high.coord[2] / MAXCVALUE;
// a box splits space into 27 subspaces (6+12+8+1) with different distance calculation
if(v_point.x < v_low.x) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Changeif( toif ( throughout this function in order to match the coding style of pgsphere.

src/gist.c Outdated
if(v_point.x < v_low.x) {
if(v_point.y < v_low.y) {
if(v_point.z < v_low.z) {
retval = distance_vector_point_3d (&v_point, v_low.x, v_low.y, v_low.z); //point2point distance
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Changedistance_vector_point_3d ( todistance_vector_point_3d( throughout this function in order to match the coding style of pgsphere.

@@ -1672,6 +1677,127 @@ fallbackSplit(Box3D *boxes, OffsetNumber maxoff, GIST_SPLITVEC *v)
v->spl_ldatum_exists = v->spl_rdatum_exists = false;
}


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

An extra blank line doesn't need to be added here.

src/gist.c Outdated
PG_RETURN_FLOAT8(retval);
}


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Two too many blank lines added here, I think.

@vitcpp
Copy link
ContributorAuthor

I used pgindent to reformat new functions in gist.c.

esabol reacted with thumbs up emoji

Copy link
Contributor

@esabolesabol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

A couple more very minor changes to the documentation, please.

Still needs an upgrade script. And maybe a version bump?

vitcpp reacted with thumbs up emoji
@@ -68,6 +68,11 @@
</para>
</listitem>
</itemizedlist>
<para>
GiST index can be also used for quickly finding the points closest to the given one
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

ChangeGiST index toA GiST index. Sorry should have caught that in my previous review.

vitcpp reacted with thumbs up emoji
@@ -82,6 +87,13 @@
<![CDATA[CREATE INDEX test_pos_idx ON test USING GIST (pos);]]>
<![CDATA[VACUUM ANALYZE test;]]>
</programlisting>
<para>
To find points closest to a given spherical position, use the <literal>&lt;-&gt;</literal> operator:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

ChangeTo find points toTo find the points.

vitcpp reacted with thumbs up emoji
@@ -0,0 +1,16 @@
-- Upgrade: 1.4.2 -> 1.5.0

CREATE FUNCTION g_spoint_distance(internal, spoint, smallint, oid, internal)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

UseCREATE OR REPLACE in the upgrade script? See issue#111.

vitcpp reacted with thumbs up emoji
Copy link
Contributor

@esabolesabol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks good to me!

Raise the version up to 1.5.0, add upgrade scriptFix issues found after the review
@vitcpp
Copy link
ContributorAuthor

Squashed latest 3 commits. The two commits are kept - the original commit and the commit with code adjustment.

@vitcppvitcpp merged commitf20a664 intopostgrespro:masterDec 22, 2023
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@esabolesabolesabol approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@vitcpp@esabol@waaeer

[8]ページ先頭

©2009-2025 Movatter.jp