Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f41e66b
MDEV-38975: HEAP engine BLOB/TEXT/JSON/GEOMETRY column support
arcivanov Mar 5, 2026
c736807
Cap `min_run_records` for small blob free-list reuse
arcivanov Mar 9, 2026
005a981
MDEV-38975: Add hash pre-check to skip expensive blob materialization…
arcivanov Mar 10, 2026
93f9f59
Set `key_part_flag` from field type in GROUP BY key setup
arcivanov Mar 11, 2026
f5da813
Fix PAD SPACE blob comparison and add blob key tests
arcivanov Mar 16, 2026
e975275
HEAP GROUP BY / DISTINCT on TEXT/BLOB columns
arcivanov Mar 17, 2026
1f82904
Skip run header for single-record blob continuation runs
arcivanov Mar 18, 2026
b276a55
Skip unchanged blobs in `heap_update()`
arcivanov Mar 18, 2026
764f85c
Consistent `hp_rec_key_cmp()` argument order in `heap_update()`
arcivanov Mar 18, 2026
ed38551
Early FULLTEXT detection for derived table engine choice
arcivanov Mar 19, 2026
72f4d9a
Clarify comments for HEAP blob continuation and tmp table overflow
arcivanov Mar 19, 2026
3041584
Introduce Field_blob_key for handling keys on blobs for temporary tables
montywi Apr 8, 2026
0f65f73
Fixed that Field_blob_compressed can be used in internal temporary ta…
montywi Apr 17, 2026
7d201a4
Removed duplicate versions of Field::row_pack_length()
montywi Apr 18, 2026
e32433e
Fixed duplicate key error when converting HEAP table Aria
montywi Apr 19, 2026
efc15c3
Code review feedback: `hp_update.c` cleanup, test renames, style fixes
arcivanov May 1, 2026
27d5000
Merge remote-tracking branch 'upstream/10.11' into MDEV-38975
arcivanov May 1, 2026
20721cb
Batch tail allocation for blob continuation chains
arcivanov May 1, 2026
5582b3e
Free-list scavenge fallback + contiguity fix for blob allocation
arcivanov May 1, 2026
4eaeb55
Disable `ps_protocol` in `blob_big` tests
arcivanov May 1, 2026
44264bf
Fix MSAN crash in `hp_rec_hashnr` for geometry/blob DISTINCT keys
arcivanov May 1, 2026
53ad2ee
Add stress test for HEAP blob insert/delete/update cycles
arcivanov May 1, 2026
e7c0514
Merge remote-tracking branch 'upstream/10.11' into MDEV-38975
arcivanov May 1, 2026
80c97f0
Add `DBUG_ASSERT` guards for MSAN regression fixes
arcivanov May 1, 2026
5d8482d
Fix MSVC `C4267` warnings: `size_t` to narrower type conversions
arcivanov May 1, 2026
0685b6c
Overflow-to-Aria on `ha_update_tmp_row()` for GROUP BY temp tables
arcivanov May 1, 2026
ed0e99d
Reclaim tail records on failed blob allocation
arcivanov May 1, 2026
d03d6b7
Avoid double blob materialization in `find_unique_row()`
arcivanov May 2, 2026
e529664
Replace `hp_blob_run_format()` enum with direct bit testing
arcivanov May 2, 2026
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*.mri.tpl
/.cproject
/.project
/.serena
.gdb_history
.vs/
/.settings/
Expand Down
20 changes: 18 additions & 2 deletions include/heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ typedef struct st_heap_block
uint recbuffer; /* Length of one saved record */
ulong records_in_block; /* Records in one heap-block */
ulong last_allocated; /* number of records there is allocated space for */
ulong high_water_allocated; /* peak last_allocated before hp_shrink_tail() */
size_t alloc_size; /* Allocate blocks of this size */
} HP_BLOCK;

Expand All @@ -131,26 +132,35 @@ typedef struct st_hp_keydef /* Key definition with open */
uint (*get_key_length)(struct st_hp_keydef *keydef, const uchar *key);
} HP_KEYDEF;

typedef struct st_hp_blob_desc
{
uint offset; /* Byte offset of blob descriptor within record buffer */
uint packlength; /* 1, 2, 3, or 4: length prefix size */
} HP_BLOB_DESC;

typedef struct st_heap_share
{
HP_BLOCK block;
HP_KEYDEF *keydef;
ulonglong data_length,index_length,max_table_size;
ulonglong auto_increment;
ulong min_records,max_records; /* Params to open */
ulong records; /* records */
ulong records; /* Logical (primary) record count */
ulong total_records; /* All active records (primary + blob continuation) */
ulong blength; /* records rounded up to 2^n */
ulong deleted; /* Deleted records in database */
uint key_stat_version; /* version to indicate insert/delete */
uint key_version; /* Updated on key change */
uint file_version; /* Update on clear */
uint reclength; /* Length of one record */
uint visible; /* Offset to the visible/deleted mark */
uint visible; /* Offset to the flags byte (active/deleted/continuation) */
uint changed;
uint keys,max_key_length;
uint currently_disabled_keys; /* saved value from "keys" when disabled */
uint open_count;
uint blob_count; /* Number of blob columns */
uchar *del_link; /* Link to next block with del. rec */
HP_BLOB_DESC *blob_descs; /* Array of blob column descriptors */
char * name; /* Name of "memory-file" */
time_t create_time;
THR_LOCK lock;
Expand Down Expand Up @@ -180,7 +190,11 @@ typedef struct st_heap_info
uint key_version; /* Version at last read */
uint file_version; /* Version at scan */
uint lastkey_len;
uint32 blob_buff_len; /* Current allocated size of blob_buff */
my_bool implicit_emptied;
my_bool has_zerocopy_blobs; /* Last hp_read_blobs produced zero-copy ptrs */
uchar *blob_buff; /* Reassembly buffer for blob reads */
ulong last_hash_of_key; /* Hash from last hp_search(), reused by hp_search_next() */
THR_LOCK_DATA lock;
LIST open_list;
} HP_INFO;
Expand All @@ -189,10 +203,12 @@ typedef struct st_heap_info
typedef struct st_heap_create_info
{
HP_KEYDEF *keydef;
HP_BLOB_DESC *blob_descs;
uint auto_key; /* keynr [1 - maxkey] for auto key */
uint auto_key_type;
uint keys;
uint reclength;
uint blob_count;
ulong max_records;
ulong min_records;
ulonglong max_table_size;
Expand Down
18 changes: 17 additions & 1 deletion include/my_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,10 @@ enum ha_base_keytype {
/* Varchar (0-65535 bytes) with length packed with 2 bytes */
HA_KEYTYPE_VARTEXT2=17, /* Key is sorted as letters */
HA_KEYTYPE_VARBINARY2=18, /* Key is sorted as unsigned chars */
HA_KEYTYPE_BIT=19
HA_KEYTYPE_BIT=19,
/* blob (length 4 bytes, pointer 8 bytes) used for internal tmp tables */
HA_KEYTYPE_VARTEXT4=20, /* Key is sorted as letters */
HA_KEYTYPE_VARBINARY4=21, /* Key is sorted as unsigned chars */
};

#define HA_MAX_KEYTYPE 31 /* Must be log2-1 */
Expand Down Expand Up @@ -313,6 +316,7 @@ enum ha_base_keytype {
#define HA_USES_PARSER 16384 /* Fulltext index uses [pre]parser */
#define HA_USES_BLOCK_SIZE ((uint) 32768)
#define HA_SORT_ALLOWS_SAME 512 /* Intern bit when sorting records */
#define HA_BLOB_PART_KEY 65536 /* Some key parts are blobs */

/* This flag can be used only in KEY::ext_key_flags */
#define HA_EXT_NOSAME 131072
Expand Down Expand Up @@ -702,4 +706,16 @@ C_MODE_START
typedef void (* invalidator_by_filename)(const char * filename);
C_MODE_END

static inline longlong read_lowendian(const uchar *from, uint bytes)
{
switch(bytes) {
case 1: return from[0];
case 2: return uint2korr(from);
case 3: return uint3korr(from);
case 4: return uint4korr(from);
case 8: return sint8korr(from);
default: DBUG_ASSERT(0); return 0;
}
}

#endif /* _my_base_h */
16 changes: 8 additions & 8 deletions include/my_compare.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ extern "C" {
typedef struct st_HA_KEYSEG /* Key-portion */
{
CHARSET_INFO *charset;
uint32 start; /* Start of key in record */
uint32 null_pos; /* position to NULL indicator */
uint16 bit_pos; /* Position to bit part */
uint32 start; /* Start of key in record */
uint32 null_pos; /* position to NULL indicator */
uint16 bit_pos; /* Position to bit part */
uint16 flag;
uint16 length; /* Keylength */
uint16 length; /* Keylength */
uint16 language;
uint8 type; /* Type of key (for sort) */
uint8 null_bit; /* bitmask to test for NULL */
uint8 bit_start;
uint8 bit_length; /* Length of bit part */
uint8 type; /* Type of key (for sort) */
uint8 null_bit; /* bitmask to test for NULL */
uint8 bit_start; /* Start of bit or length of record packing */
uint8 bit_length; /* Length of bit part or length of key packing */
} HA_KEYSEG;

#define get_key_length(length,key) \
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/include/mtr_check.sql
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ BEGIN
collation_name, column_type, column_key, extra, column_comment
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_schema='mysql'
ORDER BY columns_in_mysql;
ORDER BY columns_in_mysql, ordinal_position;

-- Dump all events, there should be none
SELECT * FROM INFORMATION_SCHEMA.EVENTS;
Expand Down
29 changes: 29 additions & 0 deletions mysql-test/main/blob_sj_test.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
set optimizer_switch='materialization=on,in_to_exists=off,semijoin=off';
set @blob_len = 16;
set @prefix_len = 6;
set @suffix_len = @blob_len - @prefix_len;
create table t1 (a1 blob(16), a2 blob(16));
create table t2 (b1 blob(16), b2 blob(16));
insert into t1 values
(concat('1 - 00', repeat('x', @suffix_len)), concat('2 - 00', repeat('x', @suffix_len)));
insert into t1 values
(concat('1 - 01', repeat('x', @suffix_len)), concat('2 - 01', repeat('x', @suffix_len)));
insert into t1 values
(concat('1 - 02', repeat('x', @suffix_len)), concat('2 - 02', repeat('x', @suffix_len)));
insert into t2 values
(concat('1 - 01', repeat('x', @suffix_len)), concat('2 - 01', repeat('x', @suffix_len)));
insert into t2 values
(concat('1 - 02', repeat('x', @suffix_len)), concat('2 - 02', repeat('x', @suffix_len)));
insert into t2 values
(concat('1 - 03', repeat('x', @suffix_len)), concat('2 - 03', repeat('x', @suffix_len)));
explain extended select left(a1,7), left(a2,7) from t1 where a1 in (select b1 from t2 where b1 > '0');
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 /* select#1 */ select left(`test`.`t1`.`a1`,7) AS `left(a1,7)`,left(`test`.`t1`.`a2`,7) AS `left(a2,7)` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`>(<in_optimizer>(`test`.`t1`.`a1`,<exists>(/* select#2 */ select `test`.`t2`.`b1` from `test`.`t2` where `test`.`t2`.`b1` > '0' and <cache>(`test`.`t1`.`a1`) = `test`.`t2`.`b1`)))
select left(a1,7), left(a2,7) from t1 where a1 in (select b1 from t2 where b1 > '0');
left(a1,7) left(a2,7)
1 - 01x 2 - 01x
1 - 02x 2 - 02x
drop table t1, t2;
32 changes: 32 additions & 0 deletions mysql-test/main/blob_sj_test.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# MDEV-38975: Test semi-join materialization with BLOB columns in HEAP
# temp tables. Added to cover a bug where HA_BLOB_PART in
# key_part_flag was uninitialized in SJ weedout temp tables, causing
# incorrect blob key handling.
#
set optimizer_switch='materialization=on,in_to_exists=off,semijoin=off';
set @blob_len = 16;
set @prefix_len = 6;
set @suffix_len = @blob_len - @prefix_len;

create table t1 (a1 blob(16), a2 blob(16));
create table t2 (b1 blob(16), b2 blob(16));

insert into t1 values
(concat('1 - 00', repeat('x', @suffix_len)), concat('2 - 00', repeat('x', @suffix_len)));
insert into t1 values
(concat('1 - 01', repeat('x', @suffix_len)), concat('2 - 01', repeat('x', @suffix_len)));
insert into t1 values
(concat('1 - 02', repeat('x', @suffix_len)), concat('2 - 02', repeat('x', @suffix_len)));

insert into t2 values
(concat('1 - 01', repeat('x', @suffix_len)), concat('2 - 01', repeat('x', @suffix_len)));
insert into t2 values
(concat('1 - 02', repeat('x', @suffix_len)), concat('2 - 02', repeat('x', @suffix_len)));
insert into t2 values
(concat('1 - 03', repeat('x', @suffix_len)), concat('2 - 03', repeat('x', @suffix_len)));

explain extended select left(a1,7), left(a2,7) from t1 where a1 in (select b1 from t2 where b1 > '0');
select left(a1,7), left(a2,7) from t1 where a1 in (select b1 from t2 where b1 > '0');

drop table t1, t2;
8 changes: 8 additions & 0 deletions mysql-test/main/column_compression.result
Original file line number Diff line number Diff line change
Expand Up @@ -2968,6 +2968,14 @@ FROM (t5 JOIN t5 AS tt ON (tt.pk != t5.pk));
DROP TABLE t5;
create table t1 (pk int not null, b1 blob compressed, v1 varbinary(100))engine=innodb;
insert into t1 values (1,'ufhjdtv','f'),(2,'jdt',''),(3,'d','tvs');
select t1.v1, t1.b1 from t1 join t1 as tt on (tt.pk != t1.pk) order by t1.v1;
v1 b1
jdt
jdt
f ufhjdtv
f ufhjdtv
tvs d
tvs d
select group_concat(t1.v1, t1.b1 order by 1) from (t1 join t1 as tt on (tt.pk != t1.pk));
group_concat(t1.v1, t1.b1 order by 1)
jdt,jdt,fufhjdtv,fufhjdtv,tvsd,tvsd
Expand Down
1 change: 1 addition & 0 deletions mysql-test/main/column_compression.test
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ DROP TABLE t5;

create table t1 (pk int not null, b1 blob compressed, v1 varbinary(100))engine=innodb;
insert into t1 values (1,'ufhjdtv','f'),(2,'jdt',''),(3,'d','tvs');
select t1.v1, t1.b1 from t1 join t1 as tt on (tt.pk != t1.pk) order by t1.v1;
select group_concat(t1.v1, t1.b1 order by 1) from (t1 join t1 as tt on (tt.pk != t1.pk));
drop table t1;

Expand Down
20 changes: 10 additions & 10 deletions mysql-test/main/count_distinct.result
Original file line number Diff line number Diff line change
Expand Up @@ -31,34 +31,34 @@ isbn city libname a
000 New York New York Public Libra 6
001 New York NYC Lib 1
006 San Fran San Fransisco Public 1
select t2.isbn,city,t1.libname,count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct t1.libname) > 1;
isbn city libname a
select min(t2.isbn),city,min(t1.libname),count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct t1.libname) > 1;
min(t2.isbn) city min(t1.libname) a
007 Berkeley Berkeley Public1 2
000 New York New York Public Libra 2
select t2.isbn,city,t1.libname,count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct concat(t1.libname,'a')) > 1;
isbn city libname a
select min(t2.isbn),city,min(t1.libname),count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct concat(t1.libname,'a')) > 1;
min(t2.isbn) city min(t1.libname) a
007 Berkeley Berkeley Public1 2
000 New York New York Public Libra 2
select t2.isbn,city,@bar:=t1.libname,count(distinct t1.libname) as a
select min(t2.isbn),city,@bar:=min(t1.libname),count(distinct t1.libname) as a
from t3 left join t1 on t3.libname=t1.libname left join t2
on t3.isbn=t2.isbn group by city having count(distinct
t1.libname) > 1;
isbn city @bar:=t1.libname a
min(t2.isbn) city @bar:=min(t1.libname) a
007 Berkeley Berkeley Public1 2
000 New York New York Public Libra 2
SELECT @bar;
@bar
Berkeley Public2
select t2.isbn,city,concat(@bar:=t1.libname),count(distinct t1.libname) as a
New York Public Libra
select min(t2.isbn),city,concat(@bar:=min(t1.libname)),count(distinct t1.libname) as a
from t3 left join t1 on t3.libname=t1.libname left join t2
on t3.isbn=t2.isbn group by city having count(distinct
t1.libname) > 1;
isbn city concat(@bar:=t1.libname) a
min(t2.isbn) city concat(@bar:=min(t1.libname)) a
007 Berkeley Berkeley Public1 2
000 New York New York Public Libra 2
SELECT @bar;
@bar
Berkeley Public2
New York Public Libra
drop table t1, t2, t3;
create table t1 (f1 int);
insert into t1 values (1);
Expand Down
14 changes: 4 additions & 10 deletions mysql-test/main/count_distinct.test
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,19 @@ insert into t1 values ('Berkeley Public1','Berkeley');
insert into t1 values ('Berkeley Public2','Berkeley');
insert into t1 values ('NYC Lib','New York');
select t2.isbn,city,t1.libname,count(t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city,t1.libname;
select t2.isbn,city,t1.libname,count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct t1.libname) > 1;
select t2.isbn,city,t1.libname,count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct concat(t1.libname,'a')) > 1;
select min(t2.isbn),city,min(t1.libname),count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct t1.libname) > 1;
select min(t2.isbn),city,min(t1.libname),count(distinct t1.libname) as a from t3 left join t1 on t3.libname=t1.libname left join t2 on t3.isbn=t2.isbn group by city having count(distinct concat(t1.libname,'a')) > 1;

select t2.isbn,city,@bar:=t1.libname,count(distinct t1.libname) as a
select min(t2.isbn),city,@bar:=min(t1.libname),count(distinct t1.libname) as a
from t3 left join t1 on t3.libname=t1.libname left join t2
on t3.isbn=t2.isbn group by city having count(distinct
t1.libname) > 1;
#
# Wrong result, see bug#49872
#
SELECT @bar;

select t2.isbn,city,concat(@bar:=t1.libname),count(distinct t1.libname) as a
select min(t2.isbn),city,concat(@bar:=min(t1.libname)),count(distinct t1.libname) as a
from t3 left join t1 on t3.libname=t1.libname left join t2
on t3.isbn=t2.isbn group by city having count(distinct
t1.libname) > 1;
#
# Wrong result, see bug#49872
#
SELECT @bar;

drop table t1, t2, t3;
Expand Down
9 changes: 3 additions & 6 deletions mysql-test/main/create.result
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ Note 1051 Unknown table 'test.t1,test.t2'
create table t1 (b char(0) not null, index(b));
ERROR 42000: The storage engine MyISAM can't index column `b`
create table t1 (a int not null,b text) engine=heap;
ERROR 42000: Storage engine MEMORY doesn't support BLOB/TEXT columns
drop table if exists t1;
Warnings:
Note 1051 Unknown table 'test.t1'
drop table t1;
create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) engine=heap;
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
create table not_existing_database.test (a int);
Expand Down Expand Up @@ -1089,7 +1086,7 @@ t1 CREATE TABLE `t1` (
`QUERY_ID` bigint(4) NOT NULL,
`INFO_BINARY` blob,
`TID` bigint(4) NOT NULL
) DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
drop table t1;
create temporary table t1 like information_schema.processlist;
show create table t1;
Expand All @@ -1113,7 +1110,7 @@ t1 CREATE TEMPORARY TABLE `t1` (
`QUERY_ID` bigint(4) NOT NULL,
`INFO_BINARY` blob,
`TID` bigint(4) NOT NULL
) DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
drop table t1;
create table t1 like information_schema.character_sets;
show create table t1;
Expand Down
3 changes: 1 addition & 2 deletions mysql-test/main/create.test
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ create table t2 select auto+1 from t1;
drop table if exists t1,t2;
--error ER_WRONG_KEY_COLUMN
create table t1 (b char(0) not null, index(b));
--error ER_TABLE_CANT_HANDLE_BLOB
create table t1 (a int not null,b text) engine=heap;
drop table if exists t1;
drop table t1;

--error ER_WRONG_AUTO_KEY
create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) engine=heap;
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/main/cte_recursive.test
Original file line number Diff line number Diff line change
Expand Up @@ -3212,6 +3212,8 @@ show create table t2;
--eval insert ignore into t2 $query;
drop table t2;
set @@sql_mode="";
# Rows with identical (level, mid) due to overflow have non-deterministic order
--sorted_result
--eval $query
--eval create table t2 as $query;
show create table t2;
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/main/derived_view.result
Original file line number Diff line number Diff line change
Expand Up @@ -2372,7 +2372,7 @@ GROUP BY TABLE_SCHEMA) AS UNIQUES
ON ( COLUMNS.TABLE_SCHEMA = UNIQUES.TABLE_SCHEMA);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY COLUMNS ALL NULL NULL NULL NULL NULL Open_frm_only; Scanned all databases
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
1 PRIMARY <derived2> ref key0 key0 194 information_schema.COLUMNS.TABLE_SCHEMA 2
2 DERIVED STATISTICS ALL NULL NULL NULL NULL NULL Open_frm_only; Scanned all databases; Using filesort
SELECT COUNT(*) > 0
FROM INFORMATION_SCHEMA.COLUMNS
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/main/distinct.result
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ insert into t1 values (1, 'Aa123456', 'abc'), (2, 'Bb7897777', 'def'),
(3, 'Cc01287', 'xyz'), (5, 'd12345', 'efg');
select distinct if(sum(a), b, 0) from t1 group by value(c) with rollup;
if(sum(a), b, 0)
Aa123456
SOME_B_VALUE
drop table t1;
#
# end of 10.5 tests
Expand Down
3 changes: 3 additions & 0 deletions mysql-test/main/distinct.test
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,9 @@ create table t1 (a int, b longtext, c varchar(18));
insert into t1 values (1, 'Aa123456', 'abc'), (2, 'Bb7897777', 'def'),
(3, 'Cc01287', 'xyz'), (5, 'd12345', 'efg');

# ROLLUP row's b value is indeterminate (depends on last group processed),
# which varies by temp table engine (HEAP vs Aria). Mask the value.
--replace_regex /(Aa123456|Bb7897777|Cc01287|d12345)/SOME_B_VALUE/
select distinct if(sum(a), b, 0) from t1 group by value(c) with rollup;
drop table t1;

Expand Down
2 changes: 1 addition & 1 deletion mysql-test/main/func_group.result
Original file line number Diff line number Diff line change
Expand Up @@ -1815,7 +1815,7 @@ CREATE TABLE t1(f1 YEAR(4));
INSERT INTO t1 VALUES (0000),(2001);
(SELECT MAX(f1) FROM t1) UNION (SELECT MAX(f1) FROM t1);
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def MAX(f1) MAX(f1) 13 4 4 Y 32864 0 63
def MAX(f1) MAX(f1) 13 4 4 Y 32868 0 63
MAX(f1)
2001
DROP TABLE t1;
Expand Down
Loading