Channels
test-channel-bot
pw-pinot
debug_upsert
feat-presto-connector
pinot-helix
troubleshooting
pinot-sketches
resources
roadmap
discuss-validation
minion-improvements
community
config-tuner
test-channel
fix-numerical-predicate
kinesis_help
pinot-perf-tuning
feat-partial-upsert
pinot_website_improvement_suggestions
segment-write-api
releases
devrel
pinot-trino
pinot-k8s-operator
release-certifier
udf-type-matching
transform-functions
release060
latency-during-segment-commit
feat-text-search
pinot-realtime-table-rebalance
inconsistent-segment
feat-rt-seg-complete
pinot-power-bi
flink-pinot-connector
pinotadls
twitter
minion-star-tree
pinot-rack-awareness
jobs
fix_llc_segment_upload
metrics-plugin-impl
linen_dev
complex-type-support
pinot-s3
feat-geo-spatial-index
feat-compound-types
v2_engine_beta_feedback
inconsistent-perf
metadata-push-api
feat-pravega-connector
enable-generic-offsets
announcements
feat-upsert
multiple_streams
feat-better-schema-evolution
fraud
onboarding
docs
aggregators
query-latency
s3-multiple-buckets
presto-pinot-connector
multi-region-setup
apa-16824
events
segment-cold-storage
odsc-europe-2022-workshop
bangalore-meetups
new-office-space
lp-pinot-poc
time-based-segment-pruner
group-by-refactor
pql-sql-regression
random
custom-aggregators
order-by
pinot-website
qps-metric
product-launch
dhill-date-seg
thirdeye-pinot
introductions
pinot-dev
getting-started
pinot-docsrus
daily-digest
general
Powered by
#troubleshooting
Title
d
Damiano
05/11/2020, 10:21 AM
Hello everybody, is there a way to create an aggregator and return more than one column as result? I have many aggregators to implements and most of them have similar implementations so i thought to share their logic inside ONE aggregator, something like:
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-stats-aggregation.html
k
Kishore G
05/11/2020, 4:37 PM
Yes. Its similar to what you did for other aggregation function
d
Damiano
05/11/2020, 5:20 PM
@Kishore G
no wait i missed that part, i know that ONE aggregator can only returns one value only, no?
I mean creating one aggregator like "stats" can i return min, max, avg etc values? instead of using min(amount), max(amount), avg(amount) and so on...
k
Kishore G
05/11/2020, 5:24 PM
you can return whatever you want from the extractFinalResult
we call toString on that
so you can return a {json}
d
Damiano
05/11/2020, 5:26 PM
omg really?? we were talking about serializing a list etc..do you remember? i did not think it was so simple
that's sounds PERFECT because i will avoid sorting the block again and again (for each aggregator)
@Kishore G
if i return a json what about the name of the columns?
can i call they something like avg_column max_column min_column
something like that?
k
Kishore G
05/11/2020, 5:42 PM
its upto you
high level name will be stats
d
Damiano
05/11/2020, 5:45 PM
Ok, if the high level is "stats" and i return a json like {"a": 1, "b": 2} does it mean that i can reach "a" doing stats.a ?
k
Kishore G
05/11/2020, 5:46 PM
yep
pinot will just return the json
you need to parse it further
d
Damiano
05/11/2020, 5:46 PM
that's awesome, you know? 😄
k
Kishore G
05/11/2020, 5:47 PM
👍
d
Damiano
05/11/2020, 5:48 PM
thats another good info to put on doc, i will do it as i told you 👍
Post