Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-10980

Reverse graph queries on OQGRAPH table actually query forward

    XMLWordPrintable

Details

    • 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 |
      +---------------+--------+--------+--------+------+--------+
      

      Attachments

        Activity

          People

            cvicentiu Vicențiu Ciorbaru
            pprkut Heinz Wiesinger
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.