Cost of reading Function 'data' inside `Call`

bottom line: Is there a way to get Function data for free while you are executing it?

I know it’s a greedy question. I have no expectations, just want to ask! :blush:

Adding data to a UDF is one way to add a lot of flexibility/configurability to them. Using Call(Function('doStuff')) incurs no Read Op, but calling Get(Function('doStuff')) inside of the function body does.

If you query simply Function('doStuff'), you get a Ref returned. That suggests to me that Call(Function('doStuff')) is already performing a data lookup of some sort.

Does Call grab the whole document in the background, or just the Function body? If the Function’s data can come along for the ride (or is already doing do), can we have access to it?

Maybe Call works more like a hidden Index with body as the value. :man_shrugging: Maybe it’s done like that specifically to avoid pulling tons of unexpected data if not necessary.

In any case, if the data were to already be there, then perhaps something like a CurrentUDF function could provide access to it. See related question I also just posted.

I can’t answer on the internal questions on whether there is already a data lookup of some sort. Probably there is but A) in a part further down the logic B) we didn’t anticipate users might want that in their results.

I’m pretty certain though that there is currently no way to retrieve that information without inserting a Get(Function(‘doStuff’)) in your query so I think you did the right thing to open a Feature Request.