Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
312942b9
Commit
312942b9
authored
May 09, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/ram/work/5.0
parents
291a628e
51e86278
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
1 deletion
+24
-1
mysql-test/r/group_min_max.result
mysql-test/r/group_min_max.result
+7
-0
mysql-test/t/group_min_max.test
mysql-test/t/group_min_max.test
+11
-0
sql/opt_range.cc
sql/opt_range.cc
+6
-1
No files found.
mysql-test/r/group_min_max.result
View file @
312942b9
...
@@ -1961,3 +1961,10 @@ a varchar(30), b varchar(30), primary key(a), key(b)
...
@@ -1961,3 +1961,10 @@ a varchar(30), b varchar(30), primary key(a), key(b)
select distinct a from t1;
select distinct a from t1;
a
a
drop table t1;
drop table t1;
create table t1(a int, key(a)) engine=innodb;
insert into t1 values(1);
select a, count(a) from t1 group by a with rollup;
a count(a)
1 1
NULL 1
drop table t1;
mysql-test/t/group_min_max.test
View file @
312942b9
...
@@ -610,3 +610,14 @@ create table t1 (
...
@@ -610,3 +610,14 @@ create table t1 (
--
enable_warnings
--
enable_warnings
select
distinct
a
from
t1
;
select
distinct
a
from
t1
;
drop
table
t1
;
drop
table
t1
;
#
# Bug #9798: group by with rollup
#
--
disable_warnings
create
table
t1
(
a
int
,
key
(
a
))
engine
=
innodb
;
--
enable_warnings
insert
into
t1
values
(
1
);
select
a
,
count
(
a
)
from
t1
group
by
a
with
rollup
;
drop
table
t1
;
sql/opt_range.cc
View file @
312942b9
...
@@ -6670,6 +6670,8 @@ cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts,
...
@@ -6670,6 +6670,8 @@ cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts,
- NGA = QA - (GA union C) = {NG_1, ..., NG_m} - the ones not in
- NGA = QA - (GA union C) = {NG_1, ..., NG_m} - the ones not in
GROUP BY and not referenced by MIN/MAX functions.
GROUP BY and not referenced by MIN/MAX functions.
with the following properties specified below.
with the following properties specified below.
B3. If Q has a GROUP BY WITH ROLLUP clause the access method is not
applicable.
SA1. There is at most one attribute in SA referenced by any number of
SA1. There is at most one attribute in SA referenced by any number of
MIN and/or MAX functions which, which if present, is denoted as C.
MIN and/or MAX functions which, which if present, is denoted as C.
...
@@ -6754,6 +6756,8 @@ cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts,
...
@@ -6754,6 +6756,8 @@ cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts,
other field as in: "select min(a) from t1 group by a" ?
other field as in: "select min(a) from t1 group by a" ?
- We assume that the general correctness of the GROUP-BY query was checked
- We assume that the general correctness of the GROUP-BY query was checked
before this point. Is this correct, or do we have to check it completely?
before this point. Is this correct, or do we have to check it completely?
- Lift the limitation in condition (B3), that is, make this access method
applicable to ROLLUP queries.
RETURN
RETURN
If mem_root != NULL
If mem_root != NULL
...
@@ -6793,7 +6797,8 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
...
@@ -6793,7 +6797,8 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
DBUG_RETURN
(
NULL
);
/* This is not a select statement. */
DBUG_RETURN
(
NULL
);
/* This is not a select statement. */
if
((
join
->
tables
!=
1
)
||
/* The query must reference one table. */
if
((
join
->
tables
!=
1
)
||
/* The query must reference one table. */
((
!
join
->
group_list
)
&&
/* Neither GROUP BY nor a DISTINCT query. */
((
!
join
->
group_list
)
&&
/* Neither GROUP BY nor a DISTINCT query. */
(
!
join
->
select_distinct
)))
(
!
join
->
select_distinct
))
||
(
thd
->
lex
->
select_lex
.
olap
==
ROLLUP_TYPE
))
/* Check (B3) for ROLLUP */
DBUG_RETURN
(
NULL
);
DBUG_RETURN
(
NULL
);
if
(
table
->
s
->
keys
==
0
)
/* There are no indexes to use. */
if
(
table
->
s
->
keys
==
0
)
/* There are no indexes to use. */
DBUG_RETURN
(
NULL
);
DBUG_RETURN
(
NULL
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment