Details
-
New Feature
-
Status: In Progress
-
Major
-
Resolution: Unresolved
-
Impala 2.2.4
-
None
Description
Add the following functions as both an aggregate function and window/analytic function:
- PERCENTILE_CONT
- PERCENTILE_DISC
- MEDIAN (impmented as PERCENTILE_CONT(0.5))
Syntax
PERCENTILE_CONT(<percentile>) WITHIN GROUP (ORDER BY <expression> [ASC|DESC] [NULLS {FIRST | LAST}]) [ OVER ([<window-partition-clause>])] PERCENTILE_DISC(<percentile>) WITHIN GROUP (ORDER BY <expression> [ASC|DESC] [NULLS {FIRST | LAST}]) [ OVER ([<window-partition-clause>])] MEDIAN(expr) [ OVER (<window-partition-clause>) ]
Notes from other systems
Greenplum
PERCENTILE_CONT(_percentage_) WITHIN GROUP (ORDER BY _expression_)
http://gpdb.docs.pivotal.io/4320/admin_guide/query.html
Greenplum Database provides the MEDIAN aggregate function, which returns the fiftieth percentile of the PERCENTILE_CONT result and special aggregate expressions for inverse distribution functions as follows:
Currently you can use only these two expressions with the keyword WITHIN GROUP.
Note: aggregation fuction only
Oracle
PERCENTILE_CONT(expr) WITHIN GROUP (ORDER BY expr [ DESC | ASC ]) [ OVER (query_partition_clause) ]}}
http://docs.oracle.com/database/121/SQLRF/functions141.htm#SQLRF00687
Note: implemented as both an aggregate and window function
Vertica
PERCENTILE_CONT ( %_number ) WITHIN GROUP (... ORDER BY expression [ ASC | DESC ] ) OVER (... [ window-partition-clause ] )
Note: window fuction only
Teradata
PERCENTILE_CONT(<value_expression>) WITHIN GROUP (ORDER BY <value_expression> [asc | desc] [nulls {first | last}])
Note: aggregation fuction only
Netezza
SELECT fn(<expr>) WITHIN GROUP (ORDER BY <value_expression> [asc|desc] [nulls {first | last}]) FROM <from_expr>[GROUP BY <group_expr>];
Note: aggregation fuction only
Redshift
PERCENTILE_CONT ( percentile ) WITHIN GROUP (ORDER BY expr) OVER ( [ PARTITION BY expr_list ] )
Note: window fuction only
Attachments
Issue Links
- is duplicated by
-
IMPALA-3602 Implement percentile and percentile_approx statistical functions
- Open
-
IMPALA-5099 support percentile analytical functions
- Resolved
- relates to
-
IMPALA-1766 Misc. statistical functions
- Resolved
1.
|
Impala Doc: Doc functions PERCENTILE_DISC(), PERCENTILE_CONT(), and MEDIAN() | Open | Unassigned |