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

Complexity asymptotic relation (theta, Big O, little o, Big Omega, little omega) between functions
What are TOP_COUNT and TOP_MAXCOUNT in BigQuery?
marklogic need advise for approach to aggregate documents
multiply(num) aggregate function in postgresql
Binding the Result of an Aggregate Function to a Projected Variable
tableau aggregate data based on dimension
where clause and aggregate functions
Is there such a thing as a join() aggregate function that concatentates field values at a specific character?
Aggregation of an expression in Django query spanning multiple tables
How to aggregate / roll up percentile measures
A peer-to-peer and privacy-aware data mining/aggregation algorithm: is it possible?
Multiple aggregates in SPARQL
SAP BO XI Desktop Intelligence Aggregate Calculations
Mondrian: Help picking the right aggregator for Measures?
Subtract 2 measures as Grand Total in SSAS Cube Browser
Non-aggregated measure in OLAP cube

Categories

HOME
azure-documentdb
packet
formatting
ibm
itext7
confluence-rest-api
angularjs-directive
richtextbox
atlassian-fisheye
restheart
subprocess
cracking
jcodemodel
facebook-sharer
aspectj
point-of-sale
adroitlogic
desktop-application
jetbrains
fine-uploader
popup
brightway
template10
amazon-data-pipeline
web-parts
powerpivot
google-calendar-api3
views
draw2d
accordion
spring-webflow
klipfolio
quality-center
datastax-enterprise
my.cnf
cloudformation
custom-fields
csproj
request-uri
ds-5
paper-trail-gem
akamai
oracle-nosql
pyenv
multi-user
outlook-2010
matrix-multiplication
delphi-xe
ape-phylo
bzip2
uitextview
head
result
gradlew
stanford-nlp-server
ionic2-select
spring-cloud-bus
flask-socketio
overhead
recursive-query
spring-social-twitter
portaudio
x12
networkstream
bytearray
mrunit
jmap
cexception
chomsky-normal-form
custom-build-step
calc
apache2-module
google-app-engine-php
github-for-mac
wiql
cloud-storage
android-networking
waterline
nexusdb
applinks
backtrace
qxorm
dirname
livescript
nsmutableurlrequest
disabled-control
switchpreference
infor-eam
git-subtree
pthreads-win32
db2-connect
google-oauth-java-client
kohana-orm
xrandr
wpa
qmainwindow
junction-table
cloudmade
mmo
ntdll
rbm
quit
correctness
hypertable
databus
advanceddatagrid
commonsware
stl-algorithm
isgl3d
peoplepicker
funambol
youtube.net-api
excellibrary
viewdata
dynamic-scope
file-icons
content-delivery-network
disk-based
jgrowl

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