|
| 1 | +--source ../include/have_columnstore.inc |
| 2 | +--source include/have_innodb.inc |
| 3 | +--source ../include/newer_11.4.6.inc |
| 4 | +--source ../include/functions.inc |
| 5 | +--source ../include/cross_engine.inc |
| 6 | + |
| 7 | +--disable_warnings |
| 8 | +DROP DATABASE IF EXISTS qa_unsupported_types; |
| 9 | +--enable_warnings |
| 10 | + |
| 11 | +CREATE DATABASE qa_unsupported_types; |
| 12 | +USE qa_unsupported_types; |
| 13 | + |
| 14 | +SELECT calsettrace(1); |
| 15 | + |
| 16 | +CREATE TABLE test_types ( |
| 17 | + id INT PRIMARY KEY, |
| 18 | + binary_col BINARY(10), |
| 19 | + varbinary_col VARBINARY(20), |
| 20 | + enum_col ENUM('small', 'medium', 'large', 'xlarge'), |
| 21 | + set_col SET('read', 'write', 'execute'), |
| 22 | + inet4_col INET4, |
| 23 | + inet6_col INET6, |
| 24 | + regular_varchar VARCHAR(50), |
| 25 | + regular_int INT |
| 26 | +) ENGINE=InnoDB; |
| 27 | + |
| 28 | +INSERT INTO test_types VALUES |
| 29 | + (1, 0x48656C6C6F, 0x576F726C64, 'small', 'read', '192.168.1.1', '2001:db8::1', 'test1', 100), |
| 30 | + (2, 0x4461746131, 0x4461746132, 'medium', 'read,write', '10.0.0.1', 'fe80::1', 'test2', 200), |
| 31 | + (3, 0x4461746133, 0x4461746134, 'large', 'write,execute', '172.16.0.1', '::1', 'test3', 300), |
| 32 | + (4, 0x4461746135, 0x4461746136, 'xlarge', 'read,write,execute', '8.8.8.8', '2001:4860:4860::8888', 'test4', 400); |
| 33 | + |
| 34 | +SET @@histogram_size=4; |
| 35 | +ANALYZE TABLE test_types PERSISTENT FOR COLUMNS (id) INDEXES(); |
| 36 | + |
| 37 | +--source ../include/enable_rbo_parallel_ces.inc |
| 38 | + |
| 39 | +SET @@columnstore_query_accel_parallel_factor=2; |
| 40 | + |
| 41 | +SELECT * FROM test_types ORDER BY id; |
| 42 | + |
| 43 | +SELECT id, enum_col, regular_varchar FROM test_types WHERE enum_col = 'medium' ORDER BY id; |
| 44 | + |
| 45 | +SELECT id, set_col, regular_int FROM test_types WHERE set_col LIKE '%write%' ORDER BY id; |
| 46 | + |
| 47 | +SELECT id, inet4_col AS ip4, regular_varchar |
| 48 | +FROM test_types |
| 49 | +WHERE inet4_col LIKE '192.%' |
| 50 | +ORDER BY id; |
| 51 | + |
| 52 | + |
| 53 | +SELECT id, inet6_col AS ip6, regular_int |
| 54 | +FROM test_types |
| 55 | +WHERE inet6_col LIKE '2001:%' |
| 56 | +ORDER BY id; |
| 57 | + |
| 58 | +SELECT enum_col, COUNT(*) as cnt, SUM(regular_int) as total |
| 59 | +FROM test_types |
| 60 | +GROUP BY enum_col |
| 61 | +ORDER BY enum_col; |
| 62 | + |
| 63 | +CREATE TABLE test_types2 ( |
| 64 | + id INT PRIMARY KEY, |
| 65 | + ref_id INT, |
| 66 | + description VARCHAR(100) |
| 67 | +) ENGINE=InnoDB; |
| 68 | + |
| 69 | +INSERT INTO test_types2 VALUES |
| 70 | + (1, 1, 'Reference to small'), |
| 71 | + (2, 2, 'Reference to medium'), |
| 72 | + (3, 3, 'Reference to large'); |
| 73 | + |
| 74 | +SET @@histogram_size=3; |
| 75 | +ANALYZE TABLE test_types2 PERSISTENT FOR COLUMNS (id) INDEXES(); |
| 76 | + |
| 77 | +SELECT t1.id, t1.enum_col, t2.description |
| 78 | +FROM test_types t1 |
| 79 | +JOIN test_types2 t2 ON t1.id = t2.ref_id |
| 80 | +ORDER BY t1.id; |
| 81 | + |
| 82 | +SET @opt_plan := mcs_get_plan('optimized'); |
| 83 | +SET @rbo_rules := mcs_get_plan('rules'); |
| 84 | + |
| 85 | +SELECT @rbo_rules LIKE '%parallel_ces%' AS rule_parallel_ces_applied; |
| 86 | + |
| 87 | +SET @rewritten_derived_name = 'derived table - $added_sub_qa_unsupported_types_test_types_0'; |
| 88 | +SELECT (CHAR_LENGTH(@opt_plan) - CHAR_LENGTH(REPLACE(@opt_plan, @rewritten_derived_name, ''))) / CHAR_LENGTH(@rewritten_derived_name) > 0 AS has_rewritten_derived_table; |
| 89 | + |
| 90 | +SELECT calsettrace(0); |
| 91 | +DROP DATABASE qa_unsupported_types; |
| 92 | + |
| 93 | +--source ../include/disable_rbo_parallel_ces.inc |
| 94 | +--source ../include/drop_functions.inc |
| 95 | +--source ../include/drop_cross_engine.inc |
0 commit comments