[
https://issues.apache.org/jira/browse/DERBY-5466?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rick Hillegas updated DERBY-5466:
---------------------------------
Attachment: derby-5466-01-aa-aggregatorClasses.diff
Attaching derby-5466-01-aa-aggregatorClasses.diff. This patch contains the
aggregator classes for var_pop(), var_samp(), stddev_pop(), and stddev_samp()
contributed by Scott via the DERBY-5466.stats.patch. Thanks, Scott!
I made a few changes:
1) Elaborated the header comments.
2) Made VarPAggregator.accumulate() increment the count field.
3) Added the new classes to extraDBMSclasses.properties since they aren't
referenced anywhere in the engine code yet. That means they weren't being
pulled into derby.jar. We may be able to revert this change, depending on how
we handle the bind/code/generate phases.
I ran the following script to verify that var_pop() agrees with the results
from an independent calculation using the IBM approach. I did not test the
other aggregators.
{noformat}
create derby aggregate varpop for double
returns double
external name 'org.apache.derby.impl.sql.execute.VarPAggregator';
create table d( a double );
insert into d values ( 1.2 ), ( 3.4 ), (5.6), (7.8), (9.0);
select varpop( a ) from d;
{noformat}
I am running full regression tests now to make sure that everything looks ok.
Touches the following files:
--------------------------
M
java/build/org/apache/derbyBuild/lastgoodjarcontents/sane.derby.jar.lastcontents
M
java/build/org/apache/derbyBuild/lastgoodjarcontents/insane.derby.jar.lastcontents
M tools/jar/extraDBMSclasses.properties
Build machinery.
--------------------------
A java/engine/org/apache/derby/impl/sql/execute/VarPAggregator.java
A java/engine/org/apache/derby/impl/sql/execute/StdDevSAggregator.java
A java/engine/org/apache/derby/impl/sql/execute/StdDevPAggregator.java
A java/engine/org/apache/derby/impl/sql/execute/VarSAggregator.java
Scott's aggregators.
> Add support for SQL Standard statistics functions, such as STDDEV_POP,
> STDDEV_SAMP, VAR_POP, VAR_SAMP
> -----------------------------------------------------------------------------------------------------
>
> Key: DERBY-5466
> URL: https://issues.apache.org/jira/browse/DERBY-5466
> Project: Derby
> Issue Type: Improvement
> Components: SQL
> Affects Versions: 10.8.1.2
> Reporter: Lukas Eder
> Priority: Minor
> Labels: derby_triage10_10
> Attachments: DERBY-5466.stats.2.patch, DERBY-5466.stats.patch,
> derby-5466-01-aa-aggregatorClasses.diff, var_pop_formulas.txt
>
>
> Any of these RDBMS support the SQL standard statistics functions STDDEV_POP,
> STDDEV_SAMP, VAR_POP, VAR_SAMP:
> - DB2 (only STDDEV, VARIANE)
> - H2
> - HSQLDB
> - Ingres
> - MySQL
> - Oracle
> - Postgres
> - SQL Server (named STDEVP, STDEV, VARP, VAR)
> - Sybase ASE
> - Sybase SQL Anywhere
> These don't:
> - Derby
> - SQLite
> This would be a useful addition for Derby, I think.
> An even larger example list of possible statistics aggregate functions is
> listed in the Postgres documentation:
> http://www.postgresql.org/docs/9.0/static/functions-aggregate.html#FUNCTIONS-AGGREGATE-STATISTICS-TABLE
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)