This commit is contained in:
Nikita Vasilev 2021-03-05 15:13:25 +03:00
parent 06454bd912
commit add3004d69
2 changed files with 22 additions and 1 deletions

View File

@ -10,3 +10,10 @@
1
1
1
0
1
1
1
1
0
0

View File

@ -1,6 +1,7 @@
DROP DATABASE IF EXISTS constraint_test;
DROP TABLE IF EXISTS constraint_test.assumption;
DROP TABLE IF EXISTS constraint_test.transitivity;
DROP TABLE IF EXISTS constraint_test.transitivity2;
SET convert_query_to_cnf = 1;
SET optimize_using_constraints = 1;
@ -26,7 +27,7 @@ SELECT count() FROM constraint_test.assumption WHERE (domainWithoutWWW(URL) = 'y
SELECT count() FROM constraint_test.assumption WHERE (domainWithoutWWW(URL) = 'yandex.ru' AND URL = '111'); ---> assumption & no assumption -> 0
SELECT count() FROM constraint_test.assumption WHERE (startsWith(URL, 'test') = True); ---> assumption -> 4
-- DROP TABLE constraint_test.assumption;
DROP TABLE constraint_test.assumption;
CREATE TABLE constraint_test.transitivity (a Int64, b Int64, c Int64, d Int32, CONSTRAINT c1 ASSUME a = b AND c = d, CONSTRAINT c2 ASSUME b = c) ENGINE = TinyLog;
@ -43,8 +44,21 @@ INSERT INTO constraint_test.strong_connectivity (a, b, c, d) VALUES ('1', '2', '
SELECT count() FROM constraint_test.strong_connectivity WHERE a = d; ---> assumption -> 1
SELECT count() FROM constraint_test.strong_connectivity WHERE a = c AND b = d; ---> assumption -> 1
SELECT count() FROM constraint_test.strong_connectivity WHERE a < c OR b < d; ---> assumption -> 0
SELECT count() FROM constraint_test.strong_connectivity WHERE a <= c OR b <= d; ---> assumption -> 1
DROP TABLE constraint_test.strong_connectivity;
CREATE TABLE constraint_test.transitivity2 (a String, b String, c String, d String, CONSTRAINT c1 ASSUME a > b AND b >= c AND c > d AND a >= d) ENGINE = TinyLog;
INSERT INTO constraint_test.transitivity2 (a, b, c, d) VALUES ('1', '2', '3', '4');
SELECT count() FROM constraint_test.transitivity2 WHERE a > d; ---> assumption -> 1
SELECT count() FROM constraint_test.transitivity2 WHERE a >= d; ---> assumption -> 1
SELECT count() FROM constraint_test.transitivity2 WHERE d < a; ---> assumption -> 1
SELECT count() FROM constraint_test.transitivity2 WHERE a < d; ---> assumption -> 0
SELECT count() FROM constraint_test.transitivity2 WHERE a = d; ---> assumption -> 0
DROP TABLE constraint_test.transitivity2;
DROP DATABASE constraint_test;