Hey folks, is there a way to fetch the nth value i...
# pinot-dev
n
Hey folks, is there a way to fetch the nth value in a multi-valued column?
@Mayank would you know?
k
What’s the data type of the column
n
String Varchar
looks like we are missing elementAt
👍 1
Copy code
arraySliceString(col, startIndex, EndIndex)
might work
you can also use groovy function as a work around for now
r
i was actually working on this so i cleaned up a bit and created a PR for the array function: https://github.com/apache/pinot/pull/9554
👍 2
v
AFAIK, Pinot does not guarantee the ordering of elements in the record of an MV column. So will it be useful to provide this functionality if the results are non-deterministic @Rong R?
r
hmm. i have no idea the order is non-deterministic do you have a doc I can follow? i can see why and try fixing it
v
Just to clarify, our current segment creation and reload code store the MV elements in same order as provided. But there are new features merged like No Forward Index for a column. Now, let’s say in reload path, we want customer wants to convert a NoForwardIndex column to a ForwardIndex column. In this case, preserving ordering for MV columns will not be possible as we flatten out the MV elements. So, I felt that Pinot’s messaging always said that ordering of MV elements is not guaranteed (and hence the name MV instead of Array)
r
CC @Jackie ^
j
@Vivek Iyer Vaidyanathan Good point on regenerating forward index, but we do preserve the order without that feature. We should warn the user that if forward index is removed, there is no way to preserve the order, but other than that we can treat MV as array
👍 4
All the existing array functions rely on that
r
This mean unless the forward index is regenerated the result is deterministic yes?
j
Yes
👍 1