Skip to content

Commit 91b31ce

Browse files
committed
Merge branch '10.9' into 10.10
2 parents 3739298 + 3476240 commit 91b31ce

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

mysql-test/main/selectivity_no_engine.result

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,29 @@ id select_type table type possible_keys key key_len ref rows Extra
314314
1 SIMPLE a ALL NULL NULL NULL NULL 5 Using where
315315
1 SIMPLE b hash_ALL NULL #hash#$hj 1341 test.a.Host,test.a.User,test.a.Password,test.a.Select_priv,test.a.Insert_priv,test.a.Update_priv,test.a.Delete_priv,test.a.Create_priv,test.a.Drop_priv,test.a.Reload_priv,test.a.Shutdown_priv,test.a.Process_priv,test.a.File_priv,test.a.Grant_priv,test.a.References_priv,test.a.Index_priv,test.a.Alter_priv,test.a.Show_db_priv,test.a.Super_priv,test.a.Create_tmp_table_priv,test.a.Lock_tables_priv,test.a.Execute_priv,test.a.Repl_slave_priv,test.a.Repl_client_priv,test.a.Create_view_priv,test.a.Show_view_priv,test.a.Create_routine_priv,test.a.Alter_routine_priv,test.a.Create_user_priv,test.a.Event_priv,test.a.Trigger_priv,test.a.Create_tablespace_priv,test.a.Delete_history_priv,test.a.ssl_type,test.a.ssl_cipher,test.a.x509_issuer,test.a.x509_subject,test.a.max_questions,test.a.max_updates,test.a.max_connections,test.a.max_user_connections,test.a.plugin,test.a.authentication_string,test.a.password_expired,test.a.is_role,test.a.default_role,test.a.max_statement_time 5 Using where; Using join buffer (flat, BNLH join)
316316
DROP TABLE t1,t2,t3;
317+
#
318+
# MDEV-31199: Assertion `field->table->stats_is_read' fails with hash_join_cardinality=on
319+
#
320+
CREATE TABLE t1 (a VARCHAR(255));
321+
INSERT INTO t1 VALUES ('u'),('uu');
322+
CREATE TABLE t2 (b VARCHAR(255)) CHARACTER SET utf8mb4;
323+
INSERT INTO t2 VALUES ('x'),('xx');
324+
CREATE TABLE t3 (c VARCHAR(255));
325+
INSERT INTO t3 VALUES ('z'),('zz');
326+
ANALYZE TABLE t1, t2, t3 PERSISTENT FOR ALL;
327+
Table Op Msg_type Msg_text
328+
test.t1 analyze status Engine-independent statistics collected
329+
test.t1 analyze status OK
330+
test.t2 analyze status Engine-independent statistics collected
331+
test.t2 analyze status OK
332+
test.t3 analyze status Engine-independent statistics collected
333+
test.t3 analyze status OK
334+
set @tmp1=@@optimizer_switch, @tmp2=@@join_cache_level;
335+
set optimizer_switch='hash_join_cardinality=on', join_cache_level=3;
336+
SELECT t1.* FROM t1 JOIN (SELECT DISTINCT b FROM t2 JOIN t3) sq ON sq.b = t1.a;
337+
a
338+
set optimizer_switch=@tmp1, join_cache_level=@tmp2;
339+
DROP TABLE t1, t2, t3;
317340
#
318341
# End of the test file
319342
#

mysql-test/main/selectivity_no_engine.test

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,26 @@ SELECT * FROM t1 AS a NATURAL JOIN t1 AS b;
250250

251251
DROP TABLE t1,t2,t3;
252252

253+
--echo #
254+
--echo # MDEV-31199: Assertion `field->table->stats_is_read' fails with hash_join_cardinality=on
255+
--echo #
256+
CREATE TABLE t1 (a VARCHAR(255));
257+
INSERT INTO t1 VALUES ('u'),('uu');
258+
259+
CREATE TABLE t2 (b VARCHAR(255)) CHARACTER SET utf8mb4;
260+
INSERT INTO t2 VALUES ('x'),('xx');
261+
262+
CREATE TABLE t3 (c VARCHAR(255));
263+
INSERT INTO t3 VALUES ('z'),('zz');
264+
265+
ANALYZE TABLE t1, t2, t3 PERSISTENT FOR ALL; # Optional, fails either way
266+
267+
set @tmp1=@@optimizer_switch, @tmp2=@@join_cache_level;
268+
set optimizer_switch='hash_join_cardinality=on', join_cache_level=3;
269+
SELECT t1.* FROM t1 JOIN (SELECT DISTINCT b FROM t2 JOIN t3) sq ON sq.b = t1.a;
270+
set optimizer_switch=@tmp1, join_cache_level=@tmp2;
271+
DROP TABLE t1, t2, t3;
272+
253273
--echo #
254274
--echo # End of the test file
255275
--echo #

sql/field.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2557,6 +2557,7 @@ Field *Field::make_new_field(MEM_ROOT *root, TABLE *new_table,
25572557
tmp->key_start.init(0);
25582558
tmp->part_of_key.init(0);
25592559
tmp->part_of_sortkey.init(0);
2560+
tmp->read_stats= NULL;
25602561
/*
25612562
TODO: it is not clear why this method needs to reset unireg_check.
25622563
Try not to reset it, or explain why it needs to be reset.

0 commit comments

Comments
 (0)