aggregate-functions


Creating percentile_cont as aggregate function in Vertica


I need an aggregate function for percentile_cont() in Vertica. However, only analytic function for it is available in this database.
Is it possible to create one using stored procedure or something? Will really appreciate any advice and steps to construct this.
Ideally, it should work like Oracle's aggregate percentile_cont() as shown in this link.
Thank you.
You can use an Analytical function still if you want to and just inline view or use with. As long as the grouping is the same as your partition, the pc_value will always be the same for that group level (as in, safe to group on).
select g1, g2, pc_value, sum(value) sum_value
from (
select g1, g2, value, PERCENTILE_CONT(.5) WITHIN GROUP(ORDER BY value)
OVER (PARTITION BY g1, g2)
) x
group by g1, g2, pc_value
You can try to create a UDX (although it won't look exactly like this because of the language construct, so you'd probably create a function with two parameters)... but I really don't think it'll perform better and this isn't too unreadable.

Related Links

Aggregations With Geomesa
incomplete results with aggregate (R)
How to do an aggregated OR on a column in Amazon Redshift
'Your query does not include the specified expression as part of an aggregate function' error for calculated fields
Creating percentile_cont as aggregate function in Vertica
Create Expression in Report Builder 3.0 Report to sum a column
SAP Hana - STRING_AGG issue with ORDER BY CLAUSE
rrdtool does not keep max
Tableau Aggregate Percentage
use aggregates (min, max, avg) in CONSTRUCT query [duplicate]
R: transposing and aggregating columns
SQL Query Aggregate Error
Usage of aggregate functions in MarkLogic
Querying customDimensions in Google Bigquery
NHibernate - QueryOver criteria appearing in Where instead in Having clause, error
Howto aggregate on full data set in Spring Batch jobs?

Categories

HOME
c#
optimization
typo3
wifi
liquibase
mediarecorder
opacity
symfony-3.2
urllib2
unreal-engine4
camunda
element
opendaylight
react-select
infopath
loss
reportlab
jquery-easyui
draw2d
hl7-fhir
bootstrap-datetimepicker
datazen-server
screen-scraping
functional-dependencies
sasl
continuous-fourier
traveling-salesman
units-of-measurement
semantic-ui-react
log4net-configuration
kubectl
fastadapter
dropdownbox
headphones
extern
kepserverex
dotnetnuke-module
area
nsdateformatter
mockserver
socketcluster
susy
vpython
amazon-rds-aurora
python-venv
infovis
pyopenssl
flask-socketio
px4
cosign-api
falcon
angularfire
treelist
paypal-subscriptions
factorization
dcast
markerspiderfier
clear
database-project
musicbrainz
tess4j
pagecontrol
transparentproxy
glog
genero
touch-typing
crtdbg.h
zoneminder
powerpoint-2010
parallel-port
isl
power-management
data-layers
adabas
kendo-window
ia-32
qmainwindow
vline
ncml
freeimage
winrt-async
systrace
erlide
gmagick
quazip
xslt-grouping
vista64
paperless

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App