Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
2135d44d
Commit
2135d44d
authored
May 10, 2013
by
Andrew McDonnell
Browse files
Options
Browse Files
Download
Plain Diff
Merge on bzr pull
parents
227bb5e0
699e3924
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
113 additions
and
77 deletions
+113
-77
mysql-test/suite/oqgraph/basic.result
mysql-test/suite/oqgraph/basic.result
+1
-6
mysql-test/suite/oqgraph/basic.test
mysql-test/suite/oqgraph/basic.test
+3
-2
mysql-test/suite/oqgraph/create_attr.test
mysql-test/suite/oqgraph/create_attr.test
+41
-3
mysql-test/suite/oqgraph/randgraphproc.inc
mysql-test/suite/oqgraph/randgraphproc.inc
+0
-62
mysql-test/suite/oqgraph/social.test
mysql-test/suite/oqgraph/social.test
+68
-4
No files found.
mysql-test/suite/oqgraph/basic.result
View file @
2135d44d
DROP TABLE IF EXISTS graph_base;
DROP TABLE IF EXISTS graph_base;
Warnings:
Note 1051 Unknown table 'graph_base'
DROP TABLE IF EXISTS graph;
DROP TABLE IF EXISTS graph;
Warnings:
Note 1051 Unknown table 'graph'
CREATE TABLE graph_base (
CREATE TABLE graph_base (
from_id INT UNSIGNED NOT NULL,
from_id INT UNSIGNED NOT NULL,
to_id INT UNSIGNED NOT NULL,
to_id INT UNSIGNED NOT NULL,
...
@@ -62,5 +58,4 @@ latch origid destid weight seq linkid
...
@@ -62,5 +58,4 @@ latch origid destid weight seq linkid
DELETE FROM graph_base;
DELETE FROM graph_base;
FLUSH TABLES;
FLUSH TABLES;
TRUNCATE TABLE graph_base;
TRUNCATE TABLE graph_base;
DROP TABLE graph;
DROP TABLE graph, graph_base;
DROP TABLE graph_base;
mysql-test/suite/oqgraph/basic.test
View file @
2135d44d
--
disable_warnings
DROP
TABLE
IF
EXISTS
graph_base
;
DROP
TABLE
IF
EXISTS
graph_base
;
DROP
TABLE
IF
EXISTS
graph
;
DROP
TABLE
IF
EXISTS
graph
;
DROP
TABLE
IF
EXISTS
graph2
;
DROP
TABLE
IF
EXISTS
graph2
;
--
enable_warnings
CREATE
TABLE
graph_base
(
CREATE
TABLE
graph_base
(
from_id
INT
UNSIGNED
NOT
NULL
,
from_id
INT
UNSIGNED
NOT
NULL
,
...
@@ -93,5 +95,4 @@ DELETE FROM graph_base;
...
@@ -93,5 +95,4 @@ DELETE FROM graph_base;
FLUSH
TABLES
;
FLUSH
TABLES
;
TRUNCATE
TABLE
graph_base
;
TRUNCATE
TABLE
graph_base
;
DROP
TABLE
graph
;
DROP
TABLE
graph
,
graph_base
;
DROP
TABLE
graph_base
;
mysql-test/suite/oqgraph/create_attr.test
View file @
2135d44d
--
disable_warnings
DROP
TABLE
IF
EXISTS
not_backing
;
DROP
TABLE
IF
EXISTS
not_backing
;
DROP
TABLE
IF
EXISTS
backing
;
DROP
TABLE
IF
EXISTS
backing
;
DROP
TABLE
IF
EXISTS
oqtable
;
DROP
TABLE
IF
EXISTS
oqtable
;
--
enable_warnings
CREATE
TABLE
`not_backing`
(
CREATE
TABLE
`not_backing`
(
id
int
(
10
)
unsigned
NOT
NULL
DEFAULT
'0'
,
id
int
(
10
)
unsigned
NOT
NULL
DEFAULT
'0'
,
...
@@ -19,6 +22,7 @@ CREATE TABLE backing (
...
@@ -19,6 +22,7 @@ CREATE TABLE backing (
KEY
name
(
info
)
KEY
name
(
info
)
)
DEFAULT
CHARSET
=
latin1
;
)
DEFAULT
CHARSET
=
latin1
;
# oqgraph v2 create table should fail (missing attributes)
# oqgraph v2 create table should fail (missing attributes)
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
;
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
;
--
error
1296
--
error
1296
...
@@ -26,102 +30,136 @@ DESCRIBE oqtable;
...
@@ -26,102 +30,136 @@ DESCRIBE oqtable;
# attributes test
# attributes test
# empty table reference
# empty table reference
DROP
TABLE
IF
EXISTS
`oqtable`
;
--
disable_warnings
DROP
TABLE
IF
EXISTS
oqtable
;
--
enable_warnings
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
''
;
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
''
;
--
error
1296
--
error
1296
DESCRIBE
oqtable
;
DESCRIBE
oqtable
;
# non-existent table reference
# non-existent table reference
DROP
TABLE
IF
EXISTS
`oqtable`
;
--
disable_warnings
DROP
TABLE
IF
EXISTS
oqtable
;
--
enable_warnings
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'bogus'
;
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'bogus'
;
--
error
1296
--
error
1296
DESCRIBE
oqtable
;
DESCRIBE
oqtable
;
# invalid table reference
# invalid table reference
DROP
TABLE
IF
EXISTS
`oqtable`
;
--
disable_warnings
DROP
TABLE
IF
EXISTS
oqtable
;
--
enable_warnings
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'not_backing'
;
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'not_backing'
;
--
error
1296
--
error
1296
DESCRIBE
oqtable
;
DESCRIBE
oqtable
;
# empty origid
# empty origid
--
disable_warnings
DROP
TABLE
IF
EXISTS
oqtable
;
DROP
TABLE
IF
EXISTS
oqtable
;
--
enable_warnings
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
''
;
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
''
;
--
error
1296
--
error
1296
DESCRIBE
oqtable
;
DESCRIBE
oqtable
;
# invalid origid reference
# invalid origid reference
--
disable_warnings
DROP
TABLE
IF
EXISTS
oqtable
;
DROP
TABLE
IF
EXISTS
oqtable
;
--
enable_warnings
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'bogus'
;
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'bogus'
;
--
error
1296
--
error
1296
DESCRIBE
oqtable
;
DESCRIBE
oqtable
;
# wrong type origid
# wrong type origid
--
disable_warnings
DROP
TABLE
IF
EXISTS
oqtable
;
DROP
TABLE
IF
EXISTS
oqtable
;
--
enable_warnings
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'not_id_type'
;
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'not_id_type'
;
--
error
1296
--
error
1296
DESCRIBE
oqtable
;
DESCRIBE
oqtable
;
# missing destid
# missing destid
--
disable_warnings
DROP
TABLE
IF
EXISTS
oqtable
;
DROP
TABLE
IF
EXISTS
oqtable
;
--
enable_warnings
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'id'
;
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'id'
;
--
error
1296
--
error
1296
DESCRIBE
oqtable
;
DESCRIBE
oqtable
;
# empty destid
# empty destid
--
disable_warnings
DROP
TABLE
IF
EXISTS
oqtable
;
DROP
TABLE
IF
EXISTS
oqtable
;
--
enable_warnings
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'id'
,
DESTID
=
''
;
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'id'
,
DESTID
=
''
;
--
error
1296
--
error
1296
DESCRIBE
oqtable
;
DESCRIBE
oqtable
;
# invalid destid reference
# invalid destid reference
--
disable_warnings
DROP
TABLE
IF
EXISTS
oqtable
;
DROP
TABLE
IF
EXISTS
oqtable
;
--
enable_warnings
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'id'
,
DESTID
=
'bogus'
;
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'id'
,
DESTID
=
'bogus'
;
--
error
1296
--
error
1296
DESCRIBE
oqtable
;
DESCRIBE
oqtable
;
# wrong type destid
# wrong type destid
--
disable_warnings
DROP
TABLE
IF
EXISTS
oqtable
;
DROP
TABLE
IF
EXISTS
oqtable
;
--
enable_warnings
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'id'
,
DESTID
=
'not_id_type'
;
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'id'
,
DESTID
=
'not_id_type'
;
--
error
1296
--
error
1296
DESCRIBE
oqtable
;
DESCRIBE
oqtable
;
# invalid origid with valid destid
# invalid origid with valid destid
--
disable_warnings
DROP
TABLE
IF
EXISTS
oqtable
;
DROP
TABLE
IF
EXISTS
oqtable
;
--
enable_warnings
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'bogus'
,
DESTID
=
'id'
;
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'bogus'
,
DESTID
=
'id'
;
--
error
1296
--
error
1296
DESCRIBE
oqtable
;
DESCRIBE
oqtable
;
# wrong type origid with valid destid
# wrong type origid with valid destid
--
disable_warnings
DROP
TABLE
IF
EXISTS
oqtable
;
DROP
TABLE
IF
EXISTS
oqtable
;
--
enable_warnings
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'not_id_type'
,
DESTID
=
'id'
;
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'not_id_type'
,
DESTID
=
'id'
;
--
error
1296
--
error
1296
DESCRIBE
oqtable
;
DESCRIBE
oqtable
;
# same origid and destid
# same origid and destid
--
disable_warnings
DROP
TABLE
IF
EXISTS
oqtable
;
DROP
TABLE
IF
EXISTS
oqtable
;
--
enable_warnings
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'id'
,
DESTID
=
'id'
;
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'id'
,
DESTID
=
'id'
;
# this should fail when we put a check in for ORIGID != DESTID
# this should fail when we put a check in for ORIGID != DESTID
# --error 1296
# --error 1296
DESCRIBE
oqtable
;
DESCRIBE
oqtable
;
# invalid weight reference
# invalid weight reference
--
disable_warnings
DROP
TABLE
IF
EXISTS
oqtable
;
DROP
TABLE
IF
EXISTS
oqtable
;
--
enable_warnings
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'id'
,
DESTID
=
'id'
,
WEIGHT
=
'bogus'
;
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'id'
,
DESTID
=
'id'
,
WEIGHT
=
'bogus'
;
--
error
1296
--
error
1296
DESCRIBE
oqtable
;
DESCRIBE
oqtable
;
# wrong type weight
# wrong type weight
--
disable_warnings
DROP
TABLE
IF
EXISTS
oqtable
;
DROP
TABLE
IF
EXISTS
oqtable
;
--
enable_warnings
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'id'
,
DESTID
=
'id'
,
WEIGHT
=
'not_weight_type'
;
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'id'
,
DESTID
=
'id'
,
WEIGHT
=
'not_weight_type'
;
--
error
1296
--
error
1296
DESCRIBE
oqtable
;
DESCRIBE
oqtable
;
# all valid
# all valid
--
disable_warnings
DROP
TABLE
IF
EXISTS
oqtable
;
DROP
TABLE
IF
EXISTS
oqtable
;
--
enable_warnings
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'id'
,
DESTID
=
'id'
,
WEIGHT
=
'weight'
;
CREATE
TABLE
oqtable
(
latch
SMALLINT
UNSIGNED
NULL
,
origid
BIGINT
UNSIGNED
NULL
,
destid
BIGINT
UNSIGNED
NULL
,
weight
DOUBLE
NULL
,
seq
BIGINT
UNSIGNED
NULL
,
linkid
BIGINT
UNSIGNED
NULL
,
KEY
(
latch
,
origid
,
destid
)
USING
HASH
,
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
,
DATA_TABLE
=
'backing'
,
ORIGID
=
'id'
,
DESTID
=
'id'
,
WEIGHT
=
'weight'
;
DESCRIBE
oqtable
;
DESCRIBE
oqtable
;
# cleanup
# cleanup
--
disable_warnings
DROP
TABLE
IF
EXISTS
oqtable
;
DROP
TABLE
IF
EXISTS
oqtable
;
DROP
TABLE
IF
EXISTS
backing
;
DROP
TABLE
IF
EXISTS
backing
;
DROP
TABLE
IF
EXISTS
not_backing
;
DROP
TABLE
IF
EXISTS
not_backing
;
--
enable_warnings
mysql-test/suite/oqgraph/randgraphproc.inc
deleted
100644 → 0
View file @
227bb5e0
# SQL implementation of randsocial.c for OQGRAPH
# Copyright (C) by Arjen Lentz <arjen@openquery.com> for Open Query
# GPL v2+ licensed with the rest of OQGRAPH
# for use in mysql-test
# 2013-03-01 first implementation based on randsocial.c in old oqgraph v2 tree
delimiter
|
;
--
disable_warnings
DROP
PROCEDURE
IF
EXISTS
randnotx
|
--
enable_warnings
CREATE
PROCEDURE
randnotx
(
INOUT
rseed
INT
,
IN
items
INT
,
IN
x
INT
,
OUT
rval
INT
)
BEGIN
REPEAT
# Simple LCG (BSD)
SET
rseed
=
(
rseed
*
1103515245
+
12345
)
&
2147483647
;
SET
rval
=
((
rseed
>>
16
)
&
32767
)
MOD
items
;
UNTIL
rval
<>
x
END
REPEAT
;
END
|
--
disable_warnings
DROP
PROCEDURE
IF
EXISTS
randgraphproc
|
--
enable_warnings
# this procedure is deterministic with its private seeded random generator
CREATE
PROCEDURE
randgraphproc
(
IN
items
INT
,
IN
friends
INT
,
IN
fanof
INT
,
IN
maxweight
INT
)
BEGIN
DECLARE
i
,
j
,
weight
,
rseed
,
rval
INT
;
# we need repeatability even in multi-threading
SET
rseed
=
items
;
SET
i
=
0
;
WHILE
i
<
items
DO
SET
j
=
0
;
WHILE
j
<
(
friends
+
fanof
)
DO
CALL
randnotx
(
rseed
,
items
,
i
,
rval
);
IF
(
maxweight
>
0
)
THEN
# Use -1 as we don't need to exclude anything
CALL
randnotx
(
rseed
,
items
,
-
1
,
weight
);
SET
weight
=
weight
MOD
maxweight
;
ELSE
SET
weight
=
0
;
END
IF
;
# SELECT CONCAT('INSERT IGNORE rsb VALUES (',i,',',rval,',',weight,');');
INSERT
IGNORE
rsb
VALUES
(
i
,
rval
,
weight
);
# only create backlinks for friends, not fans
IF
(
j
<
friends
)
THEN
# SELECT CONCAT('INSERT IGNORE rsb VALUES (',rval,',',i,',',weight,');');
INSERT
IGNORE
rsb
VALUES
(
rval
,
i
,
weight
);
END
IF
;
SET
j
=
j
+
1
;
END
WHILE
;
SET
i
=
i
+
1
;
END
WHILE
;
END
|
DELIMITER
;;
mysql-test/suite/oqgraph/social.test
View file @
2135d44d
--
disable_warnings
DROP
TABLE
IF
EXISTS
rsb
,
rsb_graph
;
--
enable_warnings
CREATE
TABLE
rsb
(
CREATE
TABLE
rsb
(
f
INT
UNSIGNED
NOT
NULL
,
f
INT
UNSIGNED
NOT
NULL
,
t
INT
UNSIGNED
NOT
NULL
,
t
INT
UNSIGNED
NOT
NULL
,
...
@@ -17,9 +21,70 @@ CREATE TABLE rsb_graph (
...
@@ -17,9 +21,70 @@ CREATE TABLE rsb_graph (
KEY
(
latch
,
destid
,
origid
)
USING
HASH
KEY
(
latch
,
destid
,
origid
)
USING
HASH
)
ENGINE
=
OQGRAPH
data_table
=
'rsb'
origid
=
'f'
destid
=
't'
weight
=
'weight'
;
)
ENGINE
=
OQGRAPH
data_table
=
'rsb'
origid
=
'f'
destid
=
't'
weight
=
'weight'
;
# this graph generator is designed to be deterministic
# this graph generator is designed to be deterministic
# (so we don't need to ship a large test dataset)
# (so we don't need to ship a large test dataset)
--
source
suite
/
oqgraph
/
randgraphproc
.
inc
# --source suite/oqgraph/randgraphproc.inc
# SQL implementation of randsocial.c for OQGRAPH
# Copyright (C) 2013 by Arjen Lentz <arjen@openquery.com> for Open Query
# GPL v2+ licensed with the rest of OQGRAPH
# for use in mysql-test
# 2013-03-01 first implementation based on randsocial.c in old oqgraph v2 tree
delimiter
|
;
--
disable_warnings
DROP
PROCEDURE
IF
EXISTS
randnotx
|
--
enable_warnings
CREATE
PROCEDURE
randnotx
(
INOUT
rseed
INT
,
IN
items
INT
,
IN
x
INT
,
OUT
rval
INT
)
DETERMINISTIC
BEGIN
REPEAT
# Simple LCG (BSD)
SET
rseed
=
(
rseed
*
1103515245
+
12345
)
&
2147483647
;
SET
rval
=
((
rseed
>>
16
)
&
32767
)
MOD
items
;
UNTIL
rval
<>
x
END
REPEAT
;
END
;
|
# this procedure is deterministic with its private seeded random generator
--
disable_warnings
DROP
PROCEDURE
IF
EXISTS
randgraphproc
|
--
enable_warnings
CREATE
PROCEDURE
randgraphproc
(
IN
items
INT
,
IN
friends
INT
,
IN
fanof
INT
,
IN
maxweight
INT
)
DETERMINISTIC
BEGIN
DECLARE
i
,
j
,
weight
,
rseed
,
rval
INT
;
SET
rseed
=
items
;
SET
i
=
0
;
WHILE
i
<
items
DO
SET
j
=
0
;
WHILE
j
<
(
friends
+
fanof
)
DO
CALL
randnotx
(
rseed
,
items
,
i
,
rval
);
IF
(
maxweight
>
0
)
THEN
CALL
randnotx
(
rseed
,
items
,
-
1
,
weight
);
SET
weight
=
weight
MOD
maxweight
;
ELSE
SET
weight
=
0
;
END
IF
;
INSERT
IGNORE
rsb
VALUES
(
i
,
rval
,
weight
);
IF
(
j
<
friends
)
THEN
INSERT
IGNORE
rsb
VALUES
(
rval
,
i
,
weight
);
END
IF
;
SET
j
=
j
+
1
;
END
WHILE
;
SET
i
=
i
+
1
;
END
WHILE
;
END
;
|
DELIMITER
;
|
# generate social graph of 10000 people having 5 friends (two-way) and being fan of 2 others (one-way)), max weight 3
# generate social graph of 10000 people having 5 friends (two-way) and being fan of 2 others (one-way)), max weight 3
CALL
randgraphproc
(
10000
,
5
,
2
,
3
);
CALL
randgraphproc
(
10000
,
5
,
2
,
3
);
...
@@ -45,7 +110,7 @@ SELECT COUNT(*) FROM rsb_graph WHERE latch=1 AND origid=976;
...
@@ -45,7 +110,7 @@ SELECT COUNT(*) FROM rsb_graph WHERE latch=1 AND origid=976;
SELECT
COUNT
(
*
)
FROM
rsb_graph
WHERE
latch
=
1
AND
origid
=
74
;
SELECT
COUNT
(
*
)
FROM
rsb_graph
WHERE
latch
=
1
AND
origid
=
74
;
# how many possible sources to here
# how many possible sources to here
# this doesn't appear to work right now in v3 ?
comes up empty but the dataset is not
# this doesn't appear to work right now in v3 ?
#if 0 in code. check with Antony
SELECT
COUNT
(
*
)
FROM
rsb_graph
WHERE
latch
=
1
AND
destid
=
1
;
SELECT
COUNT
(
*
)
FROM
rsb_graph
WHERE
latch
=
1
AND
destid
=
1
;
SELECT
COUNT
(
*
)
FROM
rsb_graph
WHERE
latch
=
1
AND
destid
=
9999
;
SELECT
COUNT
(
*
)
FROM
rsb_graph
WHERE
latch
=
1
AND
destid
=
9999
;
SELECT
COUNT
(
*
)
FROM
rsb_graph
WHERE
latch
=
1
AND
destid
=
52
;
SELECT
COUNT
(
*
)
FROM
rsb_graph
WHERE
latch
=
1
AND
destid
=
52
;
...
@@ -56,8 +121,7 @@ SELECT COUNT(*) FROM rsb_graph WHERE latch=1 AND destid=6483;
...
@@ -56,8 +121,7 @@ SELECT COUNT(*) FROM rsb_graph WHERE latch=1 AND destid=6483;
# joins
# joins
# cleaning up our tables
# cleaning up our tables
DROP
TABLE
IF
EXISTS
rsb_graph
;
DROP
TABLE
rsb_graph
,
rsb
;
DROP
TABLE
IF
EXISTS
rsb
;
# cleaning up procs from randgraphproc.inc
# cleaning up procs from randgraphproc.inc
DROP
PROCEDURE
randgraphproc
;
DROP
PROCEDURE
randgraphproc
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment