adriangb commented on issue #27631:
URL: https://github.com/apache/datafusion/issues/27631#issuecomment-7123633675

   >  So the documentation is kind of saying this is a coarse grained cost 
model. If that interpretation is incorrect, then what would a more accurate 
description of these variants be? Apologies that I keep revisiting this 
question, I just haven't been able to come up with a proper answer myself.
   
   The original intention was that `MoveTowardsLeafNodes` would be "potentially 
much much cheaper to evaluate during a scan and never much more expensive" 
(because e.g. we can read only some struct fields, or in the case of variant 
can check if the fields are shredded) and for `KeepInPlace` to be "leave it 
alone, we don't know if it's cheap or expensive". Evidently this is _some sort_ 
of cost model. When we looked at struct field access specifically it was pretty 
clear cut: a metadata only operation clearly fits any definition of 
`MoveTowardsLeafNodes`. The file/row functions also fit this bill and use the 
same mechanisms (https://github.com/apache/datafusion/pull/27669). It gets a 
bit more questionable with something like `variant_get`: if a field is not 
shredded there is some work that will be done that technically could be cheaper 
if done after a filter.
   
   So the intention was to have some sort of _really stupid cost model_ along 
the lines of "expensive or unknown" vs. "opted into / know to be cheap". But 
that gets a bit confused with "cheap -> should push it into scan". Maybe what 
we ware looking to express is "this expression is best evaluated by a scan"? I 
think this sort of simplistic cost model aligns with what Lía's research in 
https://github.com/apache/datafusion/issues/27631#issuecomment-7097050084 shows 
(e.g. Spark has an "is expensive" boolean).
   
   Regarding 
https://github.com/apache/datafusion/issues/27631#issuecomment-7077943386: I'm 
happy to go down this path, the names you propose do make sense. I do worry 
about breaking API changes, but I see you propose doing docs first. Maybe it 
would help to list out current / proposed consumers of these APIs? Off the top 
of my head:
   - struct field access
   - variant field access
   - file-linked functions (#27669)
   
   Are there any I'm missing that you can think of?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to