You can use an ObjectHolder to maintain a random pointer to anything in a workspace variable. See an example here [1] (note that the reference example is a template, not exactly a java file, you'll need to compile the code to see the complete example). However, I don't think that [1] alone will allow you to achieve what you want. That is because I don't think aggregation functions can have complex outputs. (This is from historical memory from long ago so I could be wrong about this. Maybe Jinfeng could say for sure.)
[1] https://github.com/apache/drill/blob/master/exec/java-exec/src/main/codegen/templates/VarCharAggrFunctions1.java#L63 -- Jacques Nadeau CTO and Co-Founder, Dremio On Mon, Apr 10, 2017 at 12:21 PM, Manuel Aristaran <[email protected]> wrote: > Hi, > > After banging my head for a few hours trying to implement an array > aggregation UDF (like Postgres’ array_agg()), I realized that there’s no > way of keeping non-primitive values in the @Workspace of a UDF. > > I posted a wish on JIRA [1], but thought I’d also ask here if there’s any > workaround to this limitation. > > Thanks, > > [1] https://issues.apache.org/jira/browse/DRILL-5421 > > — > Manuel Aristarán <[email protected]> > Datawheel LLC > Cambridge, MA > > > >
