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
b98c93e0
Commit
b98c93e0
authored
Nov 01, 2005
by
hf@deer.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for bug #14445 (analyse.test fails)
parent
69cd4c1e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
8 deletions
+14
-8
mysql-test/r/analyse.result
mysql-test/r/analyse.result
+3
-3
sql/sql_analyse.cc
sql/sql_analyse.cc
+11
-5
No files found.
mysql-test/r/analyse.result
View file @
b98c93e0
...
...
@@ -107,7 +107,7 @@ insert into t1 values(1.1);
insert into t1 values(2.2);
select * from t1 procedure analyse();
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
test.t1.df 1.1 2.2 8 8 0 0 1.650000000 0.
302500
000 ENUM('1.1','2.2') NOT NULL
test.t1.df 1.1 2.2 8 8 0 0 1.650000000 0.
55
000 ENUM('1.1','2.2') NOT NULL
drop table t1;
create table t1 (d double);
insert into t1 values (100000);
...
...
@@ -138,6 +138,6 @@ insert into t2 values (1, 'USA'),(2,'India'), (3,'Finland');
select product, sum(profit),avg(profit) from t1 group by product with rollup procedure analyse();
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
test.t1.product Computer TV 2 8 0 0 4.2500 NULL ENUM('Computer','Phone','TV') NOT NULL
sum(profit) 10 6900
2 4 0 0 1946 2868
ENUM('10','275','600','6900') NOT NULL
avg(profit) 10.0000
1380.0000 7 9 0 0 394.6875 570.2003
ENUM('10.0000','68.7500','120.0000','1380.0000') NOT NULL
sum(profit) 10 6900
11 11 0 0 1946 2867.6719
ENUM('10','275','600','6900') NOT NULL
avg(profit) 10.0000
00000 1380.000000000 21 21 0 0 394.687500000 570.20033144
ENUM('10.0000','68.7500','120.0000','1380.0000') NOT NULL
drop table t1,t2;
sql/sql_analyse.cc
View file @
b98c93e0
...
...
@@ -1036,13 +1036,19 @@ String *field_decimal::std(String *s, ha_rows rows)
s
->
set
((
double
)
0.0
,
1
,
my_thd_charset
);
return
s
;
}
my_decimal
num
,
std_val
,
sum2
,
sum2d
;
my_decimal
num
,
tmp
,
sum2
,
sum2d
;
double
std_sqr
;
int
prec_increment
=
current_thd
->
variables
.
div_precincrement
;
int2my_decimal
(
E_DEC_FATAL_ERROR
,
rows
-
nulls
,
FALSE
,
&
num
);
my_decimal_mul
(
E_DEC_FATAL_ERROR
,
&
sum2
,
sum
+
cur_sum
,
sum
+
cur_sum
);
my_decimal_div
(
E_DEC_FATAL_ERROR
,
&
std_val
,
&
sum2
,
&
num
,
0
);
my_decimal_sub
(
E_DEC_FATAL_ERROR
,
&
sum2
,
sum_sqr
+
cur_sum
,
&
std_val
);
my_decimal_div
(
E_DEC_FATAL_ERROR
,
&
std_val
,
&
sum2
,
&
num
,
0
);
my_decimal2string
(
E_DEC_FATAL_ERROR
,
&
std_val
,
0
,
0
,
'0'
,
s
);
my_decimal_div
(
E_DEC_FATAL_ERROR
,
&
tmp
,
&
sum2
,
&
num
,
prec_increment
);
my_decimal_sub
(
E_DEC_FATAL_ERROR
,
&
sum2
,
sum_sqr
+
cur_sum
,
&
tmp
);
my_decimal_div
(
E_DEC_FATAL_ERROR
,
&
tmp
,
&
sum2
,
&
num
,
prec_increment
);
my_decimal2double
(
E_DEC_FATAL_ERROR
,
&
tmp
,
&
std_sqr
);
s
->
set
(((
double
)
std_sqr
<=
0.0
?
0.0
:
sqrt
(
std_sqr
)),
min
(
item
->
decimals
+
prec_increment
,
NOT_FIXED_DEC
),
my_thd_charset
);
return
s
;
}
...
...
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