[MDEV-10980] Reverse graph queries on OQGRAPH table actually query forward Created: 2016-10-08  Updated: 2017-10-09  Due: 2016-12-22  Resolved: 2017-10-09

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - OQGRAPH
Affects Version/s: 10.1.18, 10.0.27, 10.2.2
Fix Version/s: 10.0.33

Type: Bug Priority: Critical
Reporter: Heinz Wiesinger Assignee: Vicențiu Ciorbaru
Resolution: Fixed Votes: 0
Labels: contribution, foundation, oqgraph

Sprint: 10.1.22, 10.2.10

 Description   

OQGRAPH has several algorithms that support listing vertices from which a path can be found to a given destination node.

Tables:

CREATE TABLE `oq_backing` (
   `origid` int(10) unsigned NOT NULL,
   `destid` int(10) unsigned NOT NULL,
   PRIMARY KEY (`origid`,`destid`),
   KEY `destid` (`destid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
CREATE TABLE `oq_graph` (
   `latch` varchar(32) DEFAULT NULL,
   `origid` bigint(20) unsigned DEFAULT NULL,
   `destid` bigint(20) unsigned DEFAULT NULL,
   `weight` double DEFAULT NULL,
   `seq` bigint(20) unsigned DEFAULT NULL,
   `linkid` bigint(20) unsigned DEFAULT NULL,
   KEY `latch` (`latch`,`origid`,`destid`) USING HASH,
   KEY `latch_2` (`latch`,`destid`,`origid`) USING HASH
) ENGINE=OQGRAPH DEFAULT CHARSET=latin1 `data_table`='oq_backing' `origid`='origid' `destid`='destid';

prepare data:

INSERT INTO oq_backing (origid, destid) VALUES (0,1), (1,2), (2,3);

query:

SELECT * FROM oq_graph WHERE latch = 'breadth_first' AND destid = 2;
+---------------+--------+--------+--------+------+--------+
| latch         | origid | destid | weight | seq  | linkid |
+---------------+--------+--------+--------+------+--------+
| breadth_first |   NULL |      2 |      1 |    2 |      3 |
| breadth_first |   NULL |      2 |      0 |    1 |      2 |
+---------------+--------+--------+--------+------+--------+



 Comments   
Comment by Elena Stepanova [ 2016-10-18 ]

For a side note, documentation link at the Open Query site doesn't work: https://openquery.com.au/graph/doc

Generated at Thu Feb 08 07:46:23 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.