Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions mysql-test/include/search_pattern_on_variable.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# ==== Purpose ====
#
# Grep an expression for a pattern, produce a single string out
# depending whether the match was found or not.
#
# The environment variables SEARCH_EXPRESSION and SEARCH_PATTERN
# must be set before sourcing this routine.
#
# ==== Usage ====
#
# --let SEARCH_EXPRESSION= TEXT
# --let SEARCH_PATTERN= TEXT
# --source include/search_pattern_on_variable.inc

perl;
use strict;
my $search_expression= $ENV{'SEARCH_EXPRESSION'} or die "SEARCH_EXPRESSION not set";
my $search_pattern= $ENV{'SEARCH_PATTERN'} or die "SEARCH_PATTERN not set";
if ($search_expression =~ /$search_pattern/)
{
print "Pattern \"$search_pattern\" found\n";
}
else
{
print "Pattern \"$search_pattern\" not found\n";
}
EOF
32 changes: 0 additions & 32 deletions mysql-test/r/hash_join.result
Original file line number Diff line number Diff line change
Expand Up @@ -916,38 +916,6 @@ SET join_buffer_size = 1024;
SELECT STRAIGHT_JOIN COUNT(*) FROM t1 JOIN t2 ON t1.col1 = t2.col1;
DROP TABLE t1, t2;
SET join_buffer_size = DEFAULT;
# See that the hints for hash join works as expected.
CREATE TABLE t1 (col1 INTEGER);
CREATE TABLE t2 (col1 INTEGER);
# By default, hash join should be used.
EXPLAIN FORMAT=tree SELECT t1.col1 FROM t1, t2;
EXPLAIN
-> Inner hash join (cost=0.70 rows=1)
-> Table scan on t2 (cost=0.35 rows=1)
-> Hash
-> Table scan on t1 (cost=0.35 rows=1)

# Try disabling hash join using the hint.
EXPLAIN FORMAT=tree SELECT /*+ NO_HASH_JOIN(t1, t2) */ t1.col1 FROM t1, t2;
EXPLAIN
<not executable by iterator executor>

# Turn off hash join using the optimizer switch, and then enable it again
# using the hint.
SET optimizer_switch="hash_join=off";
EXPLAIN FORMAT=tree SELECT t1.col1 FROM t1, t2;
EXPLAIN
<not executable by iterator executor>

EXPLAIN FORMAT=tree SELECT /*+ HASH_JOIN(t1, t2) */ t1.col1 FROM t1, t2;
EXPLAIN
-> Inner hash join (cost=0.70 rows=1)
-> Table scan on t2 (cost=0.35 rows=1)
-> Hash
-> Table scan on t1 (cost=0.35 rows=1)

SET optimizer_switch=DEFAULT;
DROP TABLE t1, t2;
#
# Bug#29964536 WL#2241: ASSERTION FAILURE IN
# TEMPTABLE::HANDLER::POSITION() AT SRC/HANDLER.CC
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/kill.result
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ INSERT INTO t2 SELECT id FROM t1;
SET DEBUG_SYNC= 'thread_end SIGNAL con1_end';
SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync';
SELECT id FROM t1 WHERE id IN
(SELECT /*+ NO_HASH_JOIN(a,b,c,d) */ DISTINCT a.id FROM t2 a, t2 b, t2 c, t2 d
(SELECT /*+ NO_BNL(a,b,c,d) */ DISTINCT a.id FROM t2 a, t2 b, t2 c, t2 d
GROUP BY ACOS(1/a.id), b.id, c.id, d.id
HAVING a.id BETWEEN 10 AND 20);
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
Expand Down
8 changes: 4 additions & 4 deletions mysql-test/r/opt_hints_subquery.result
Original file line number Diff line number Diff line change
Expand Up @@ -1649,21 +1649,21 @@ Note 1003 /* select#1 */ select /*+ SUBQUERY(@`subq` MATERIALIZATION) */ `test`.
This query does not support Subquery Materialization due to type mismatch
EXPLAIN
SELECT * FROM t2
WHERE t2.a IN (SELECT /*+ QB_NAME(subq) */ sum(b) FROM t1 group by a);
WHERE t2.a IN (SELECT /*+ QB_NAME(subq) */ concat(sum(b),"") FROM t1 group by a);
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 NULL index NULL a 4 NULL 4 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 NULL
Warnings:
Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(/* select#2 */ select /*+ QB_NAME(`subq`) */ 1 from `test`.`t1` group by `test`.`t1`.`a` having (<cache>(`test`.`t2`.`a`) = <ref_null_helper>(sum(`test`.`t1`.`b`)))))
Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(/* select#2 */ select /*+ QB_NAME(`subq`) */ 1 from `test`.`t1` group by `test`.`t1`.`a` having (<cache>(`test`.`t2`.`a`) = <ref_null_helper>(concat(sum(`test`.`t1`.`b`),'')))))
Trying to force Subquery Materialization will not change anything
EXPLAIN
SELECT /*+ SUBQUERY(@subq MATERIALIZATION) */ * FROM t2
WHERE t2.a IN (SELECT /*+ QB_NAME(subq) */ sum(b) FROM t1 group by a);
WHERE t2.a IN (SELECT /*+ QB_NAME(subq) */ concat(sum(b),"") FROM t1 group by a);
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 NULL index NULL a 4 NULL 4 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 NULL
Warnings:
Note 1003 /* select#1 */ select /*+ SUBQUERY(@`subq` MATERIALIZATION) */ `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(/* select#2 */ select /*+ QB_NAME(`subq`) */ 1 from `test`.`t1` group by `test`.`t1`.`a` having (<cache>(`test`.`t2`.`a`) = <ref_null_helper>(sum(`test`.`t1`.`b`)))))
Note 1003 /* select#1 */ select /*+ SUBQUERY(@`subq` MATERIALIZATION) */ `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(/* select#2 */ select /*+ QB_NAME(`subq`) */ 1 from `test`.`t1` group by `test`.`t1`.`a` having (<cache>(`test`.`t2`.`a`) = <ref_null_helper>(concat(sum(`test`.`t1`.`b`),'')))))
Test hints with prepared statements
PREPARE stmt1 FROM "EXPLAIN
SELECT /*+ SUBQUERY(@subq1 MATERIALIZATION)
Expand Down
8 changes: 6 additions & 2 deletions mysql-test/r/subquery_mat.result
Original file line number Diff line number Diff line change
Expand Up @@ -503,12 +503,16 @@ explain
select * from t1 group by (a1 in (select col from columns));
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using temporary
2 DEPENDENT SUBQUERY columns NULL unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using where; Using index; Full scan on NULL key
2 SUBQUERY columns NULL index PRIMARY PRIMARY 4 NULL 2 100.00 Using index
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` group by <in_optimizer>(`test`.`t1`.`a1`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`a1`) in columns on PRIMARY where <if>(outer_field_is_not_null, (<cache>(`test`.`t1`.`a1`) = `test`.`columns`.`col`), true))))
Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` group by <in_optimizer>(`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( <materialize> (/* select#2 */ select `test`.`columns`.`col` from `test`.`columns` where true ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on <auto_distinct_key> where ((`test`.`t1`.`a1` = `materialized-subquery`.`col`)))))
select * from t1 group by (a1 in (select col from columns));
a1 a2
1 - 00 2 - 00
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '1 - 00'
Warning 1292 Truncated incorrect DOUBLE value: '1 - 01'
Warning 1292 Truncated incorrect DOUBLE value: '1 - 02'
/* ORDER BY clause */
explain
select * from t1 order by (select col from columns limit 1);
Expand Down
8 changes: 6 additions & 2 deletions mysql-test/r/subquery_mat_all.result
Original file line number Diff line number Diff line change
Expand Up @@ -503,12 +503,16 @@ explain
select * from t1 group by (a1 in (select col from columns));
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using temporary
2 DEPENDENT SUBQUERY columns NULL unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using where; Using index; Full scan on NULL key
2 SUBQUERY columns NULL index PRIMARY PRIMARY 4 NULL 2 100.00 Using index
Warnings:
Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` group by <in_optimizer>(`test`.`t1`.`a1`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`a1`) in columns on PRIMARY where <if>(outer_field_is_not_null, (<cache>(`test`.`t1`.`a1`) = `test`.`columns`.`col`), true))))
Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` group by <in_optimizer>(`test`.`t1`.`a1`,`test`.`t1`.`a1` in ( <materialize> (/* select#2 */ select `test`.`columns`.`col` from `test`.`columns` where true ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on <auto_distinct_key> where ((`test`.`t1`.`a1` = `materialized-subquery`.`col`)))))
select * from t1 group by (a1 in (select col from columns));
a1 a2
1 - 00 2 - 00
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '1 - 00'
Warning 1292 Truncated incorrect DOUBLE value: '1 - 01'
Warning 1292 Truncated incorrect DOUBLE value: '1 - 02'
/* ORDER BY clause */
explain
select * from t1 order by (select col from columns limit 1);
Expand Down
Loading