Implementing a custom `FLATTEN` function

Hi

I’m the dev behind Dremio UDF GIS
I’m making progress and even started working on aggregation functions implementation, seeing success thus far.

I was wondering about the ability/possibility to implement a custom FLATTEN function.
Say I have a big VarBinary blob that containes a structured list of smaller var binary instances. I’d like to be able to flatten that, e.g. call my function that’ll apply my custom serialization logic and return subordinate var binaries as separate rows, much like the built in FLATTEN does for raw JSON arrays.

Looking around the source code, I found DummyFlatten but from its name and implementation, looks like the magic is happening somewhere else, probably because flatten is part more of physical phase type of thingie.

Any idea on how to at least start implementing such a functionality?
Or even tap into existing flattening capabilities (e.g. have a custom function considered as a flattner)?

Any idea on how to achieve this?