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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
8de3f2e7
Commit
8de3f2e7
authored
Dec 10, 2003
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/kostja/mysql/mysql-4.0-root
into mysql.com:/home/kostja/mysql/mysql-4.0-1790
parents
2c25a86b
4101abf3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
10 deletions
+30
-10
mysql-test/r/func_group.result
mysql-test/r/func_group.result
+17
-6
mysql-test/t/func_group.test
mysql-test/t/func_group.test
+8
-0
sql/item_sum.cc
sql/item_sum.cc
+5
-4
No files found.
mysql-test/r/func_group.result
View file @
8de3f2e7
...
...
@@ -207,13 +207,13 @@ drop table t1,t2;
CREATE TABLE t1 (a int, b int);
select count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1;
count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
0 NULL NULL NULL NULL NULL
-1
0
0 NULL NULL NULL NULL NULL
18446744073709551615
0
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
insert into t1 values (1,null);
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
1 0 NULL NULL NULL NULL NULL
-1
0
1 0 NULL NULL NULL NULL NULL
18446744073709551615
0
insert into t1 values (1,null);
insert into t1 values (2,null);
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
...
...
@@ -222,8 +222,8 @@ a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
2 0 NULL NULL NULL NULL NULL 18446744073709551615 0
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
1 0 NULL NULL NULL NULL NULL
-1
0
2 0 NULL NULL NULL NULL NULL
-1
0
1 0 NULL NULL NULL NULL NULL
18446744073709551615
0
2 0 NULL NULL NULL NULL NULL
18446744073709551615
0
insert into t1 values (2,1);
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
...
...
@@ -231,7 +231,7 @@ a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
2 1 1 1.0000 0.0000 1 1 1 1
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
1 0 NULL NULL NULL NULL NULL
-1
0
1 0 NULL NULL NULL NULL NULL
18446744073709551615
0
2 1 1 1.0000 0.0000 1 1 1 1
insert into t1 values (3,1);
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
...
...
@@ -241,7 +241,18 @@ a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
3 1 1 1.0000 0.0000 1 1 1 1
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
1 0 NULL NULL NULL NULL NULL
-1
0
1 0 NULL NULL NULL NULL NULL
18446744073709551615
0
2 1 1 1.0000 0.0000 1 1 1 1
3 1 1 1.0000 0.0000 1 1 1 1
drop table t1;
create table t1 (col int);
insert into t1 values (-1), (-2), (-3);
select bit_and(col), bit_or(col) from t1;
bit_and(col) bit_or(col)
18446744073709551612 18446744073709551615
select SQL_BIG_RESULT bit_and(col), bit_or(col) from t1 group by col;
bit_and(col) bit_or(col)
18446744073709551613 18446744073709551613
18446744073709551614 18446744073709551614
18446744073709551615 18446744073709551615
drop table t1;
mysql-test/t/func_group.test
View file @
8de3f2e7
...
...
@@ -147,3 +147,11 @@ insert into t1 values (3,1);
select
a
,
count
(
b
),
sum
(
b
),
avg
(
b
),
std
(
b
),
min
(
b
),
max
(
b
),
bit_and
(
b
),
bit_or
(
b
)
from
t1
group
by
a
;
select
SQL_BIG_RESULT
a
,
count
(
b
),
sum
(
b
),
avg
(
b
),
std
(
b
),
min
(
b
),
max
(
b
),
bit_and
(
b
),
bit_or
(
b
)
from
t1
group
by
a
;
drop
table
t1
;
#
# Bug #1972: test for bit_and(), bit_or() and negative values
#
create
table
t1
(
col
int
);
insert
into
t1
values
(
-
1
),
(
-
2
),
(
-
3
);
select
bit_and
(
col
),
bit_or
(
col
)
from
t1
;
select
SQL_BIG_RESULT
bit_and
(
col
),
bit_or
(
col
)
from
t1
group
by
col
;
drop
table
t1
;
sql/item_sum.cc
View file @
8de3f2e7
...
...
@@ -104,12 +104,13 @@ Item_sum_num::val_str(String *str)
String
*
Item_sum_int
::
val_str
(
String
*
str
)
{
longlong
nr
=
val_int
();
longlong
nr
=
val_int
();
if
(
null_value
)
return
0
;
char
buff
[
21
];
uint
length
=
(
uint
)
(
longlong10_to_str
(
nr
,
buff
,
-
10
)
-
buff
);
str
->
copy
(
buff
,
length
);
if
(
unsigned_flag
)
str
->
set
((
ulonglong
)
nr
);
else
str
->
set
(
nr
);
return
str
;
}
...
...
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