Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSoC 2023: Yige Huang Week 2 #299

Merged
merged 8 commits into from
Jun 10, 2023
38 changes: 19 additions & 19 deletions docqueries/withPoints/doc-pgr_withPointsDD.result
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ SELECT * FROM pgr_withPointsDD(
-1, 3.3,
driving_side => 'r',
details => true);
seq | node | edge | cost | agg_cost
-----+------+------+------+----------
1 | -1 | -1 | 0 | 0
2 | 5 | 1 | 0.4 | 0.4
3 | 6 | 1 | 1 | 1.4
4 | -6 | 4 | 0.7 | 2.1
5 | 7 | 4 | 0.3 | 2.4
seq | start_vid | node | edge | cost | agg_cost
-----+-----------+------+------+------+----------
1 | -1 | -1 | -1 | 0 | 0
2 | -1 | 5 | 1 | 0.4 | 0.4
3 | -1 | 6 | 1 | 1 | 1.4
4 | -1 | -6 | 4 | 0.7 | 2.1
5 | -1 | 7 | 4 | 0.3 | 2.4
(5 rows)

/* -- q3 */
Expand Down Expand Up @@ -50,18 +50,18 @@ SELECT * FROM pgr_withPointsDD(
-1, 3.3,
driving_side => 'b',
details => true);
seq | node | edge | cost | agg_cost
-----+------+------+------+----------
1 | -1 | -1 | 0 | 0
2 | 5 | 1 | 0.4 | 0.4
3 | 6 | 1 | 0.6 | 0.6
4 | -6 | 4 | 0.7 | 1.3
5 | 7 | 4 | 0.3 | 1.6
6 | 3 | 7 | 1 | 2.6
7 | 8 | 10 | 1 | 2.6
8 | 11 | 8 | 1 | 2.6
9 | -3 | 12 | 0.6 | 3.2
10 | -4 | 6 | 0.7 | 3.3
seq | start_vid | node | edge | cost | agg_cost
-----+-----------+------+------+------+----------
1 | -1 | -1 | -1 | 0 | 0
2 | -1 | 5 | 1 | 0.4 | 0.4
3 | -1 | 6 | 1 | 0.6 | 0.6
4 | -1 | -6 | 4 | 0.7 | 1.3
5 | -1 | 7 | 4 | 0.3 | 1.6
6 | -1 | 3 | 7 | 1 | 2.6
7 | -1 | 8 | 10 | 1 | 2.6
8 | -1 | 11 | 8 | 1 | 2.6
9 | -1 | -3 | 12 | 0.6 | 3.2
10 | -1 | -4 | 6 | 0.7 | 3.3
(10 rows)

/* -- q5 */
Expand Down
4 changes: 2 additions & 2 deletions pgtap/withPoints/withPointsDD/types_check.pg
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ SELECT function_returns('pgr_withpointsdd', ARRAY['text','text','anyarray','doub
SELECT set_eq(
$$SELECT proargnames from pg_proc where proname = 'pgr_withpointsdd'$$,
$$VALUES
('{"","","","","directed","driving_side","details","seq","node","edge","cost","agg_cost"}'::TEXT[]),
('{"","","","","directed","driving_side","details","seq","start_vid","node","edge","cost","agg_cost"}'::TEXT[]),
('{"","","","","directed","driving_side","details","equicost","seq","start_vid","node","edge","cost","agg_cost"}'::TEXT[])
$$);

SELECT set_eq(
$$SELECT proallargtypes from pg_proc where proname = 'pgr_withpointsdd'$$,
$$VALUES
('{25,25,20,701,16,1042,16,23,20,20,701,701}'::OID[]),
('{25,25,20,701,16,1042,16,23,20,20,20,701,701}'::OID[]),
('{25,25,2277,701,16,1042,16,16,23,20,20,20,701,701}'::OID[])
$$);

Expand Down
2 changes: 1 addition & 1 deletion sql/driving_distance/_withPointsDD.sql
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ CREATE FUNCTION _pgr_withPointsDD(
distance FLOAT,

directed BOOLEAN DEFAULT true,
driving_side CHAR DEFAULT 'b',
driving_side CHAR DEFAULT 'r',
Copy link
Member

Choose a reason for hiding this comment

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

I still like the default value to be r, About getting rid of b we need to discuss

details BOOLEAN DEFAULT false,
equicost BOOLEAN DEFAULT false,

Expand Down
15 changes: 8 additions & 7 deletions sql/driving_distance/withPointsDD.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,41 +23,42 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
********************************************************************PGR-GNU*/

-- SINGLE
--v2.6
--v3.6
CREATE FUNCTION pgr_withPointsDD(
TEXT, --edges_sql (required)
TEXT, -- points_sql (required)
BIGINT, -- from_vid (required)
FLOAT, -- distance (required)

directed BOOLEAN DEFAULT true,
driving_side CHAR DEFAULT 'b',
driving_side CHAR DEFAULT 'r',
details BOOLEAN DEFAULT false,

OUT seq INTEGER,
OUT start_vid BIGINT,
OUT node BIGINT,
OUT edge BIGINT,
OUT cost FLOAT,
OUT agg_cost FLOAT)
RETURNS SETOF RECORD AS
$BODY$
SELECT seq, node, edge, cost, agg_cost
SELECT seq, start_vid, node, edge, cost, agg_cost
FROM _pgr_withPointsDD(_pgr_get_statement($1), _pgr_get_statement($2), ARRAY[$3]::BIGINT[], $4, $5, $6, $7, false);
$BODY$
LANGUAGE SQL VOLATILE STRICT
COST 100
ROWS 1000;

-- MULTIPLE
--v2.6
--v3.6
CREATE FUNCTION pgr_withPointsDD(
TEXT, --edges_sql (required)
TEXT, -- points_sql (required)
ANYARRAY, -- from_vid (required)
FLOAT, -- distance (required)

directed BOOLEAN DEFAULT true,
driving_side CHAR DEFAULT 'b',
driving_side CHAR DEFAULT 'r',
Copy link
Member

Choose a reason for hiding this comment

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

This is a tricky change,
Basically the default for versions 3.5 & under is band the default for 3.6 and after is r
For the moment lest leave it like it is here, but open an issue "reminder of default value" in your fork and put a link to this comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

issue for reminder: squarege#5

Copy link
Member

Choose a reason for hiding this comment

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

See #300

details BOOLEAN DEFAULT false,
equicost BOOLEAN DEFAULT false,

Expand Down Expand Up @@ -89,7 +90,7 @@ IS 'pgr_withPointsDD(Single Vertex)
- Distance
- Optional Parameters
- directed := true
- driving_side := b
- driving_side := r
- details := false
- Documentation:
- ${PROJECT_DOC_LINK}/pgr_withPointsDD.html
Expand All @@ -106,7 +107,7 @@ IS 'pgr_withPointsDD(Multiple Vertices)
- Distance
- Optional Parameters
- directed := true
- driving_side := b
- driving_side := r
- details := false
- equicost := false
- Documentation:
Expand Down