https://pinot.apache.org/ logo
#general
Title
# general
n

Neil Teng

05/20/2021, 1:33 PM
Hey, do we have any example querying/working on the multi-value column? I cannot find one in the document. e.g. get the first element in the multi-val column.
m

Mayank

05/20/2021, 2:00 PM
How do you want to use it? Note that it not necessarily be ordered.
n

Neil Teng

05/20/2021, 2:52 PM
I see. I have a column with a list of addresses of the customer, where each one is a json.
m

Mayank

05/20/2021, 3:09 PM
@User do we preserve MV column order? Rather should client rely on ordering?
j

Jackie

05/20/2021, 3:13 PM
We do preserver the order in MV column
Currently we don't have a function to pick the first element within a MV column, but it should be easy to add or plug in
n

Neil Teng

05/20/2021, 3:17 PM
The ordering is not important. I want to know how to fetch the first or the second element in the MV column. Do we have a pinot function to do that?
j

Jackie

05/20/2021, 3:18 PM
In
ArrayFunctions
we have several functions that applies to array. You may plug-in your own function with
ScalarFunction
annotation
n

Neil Teng

05/20/2021, 3:21 PM
Thanks, I will check that out. One more question, do you happen to know the behavior of trino/prestodb when it query a MV column? Any function I should applied on the result to be recognized as a array in trino?
j

Jackie

05/20/2021, 3:24 PM
@User ^^
n

Neha Pawar

05/20/2021, 3:37 PM
You could use a groovy function to fetch a particular element from the array
m

Mayank

05/20/2021, 4:44 PM
I think the ask is for fetching it during query time.
n

Neha Pawar

05/20/2021, 4:46 PM
we have groovy for query time too
👍 2
x

Xiang Fu

05/20/2021, 5:38 PM
Prestodb should treat mv column as an array
n

Neha Pawar

05/20/2021, 5:44 PM
several examples of getting elements from MV columns using groovy: https://docs.pinot.apache.org/users/user-guide-query/scalar-functions
m

Mayank

05/20/2021, 5:44 PM
Thanks @User