You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exprs can use the built-in field disambiguation for structuring, but there are more Commands than those in this MWE, which require a union strategy using the tag field
Weirdly enough, I'm able to successfully structure fields in Select, where Exprs are within a tuple, but not in Where, which chooses the base empty Expr() type!
I'd expect to see Where(expr=Literal(value=1)) instead.
What I Did
I tried walking the conversion function, and it seems that the generated Where structuring function is hardcoded to use the base Expr, instead of attempting to use the subclass dispatcher.
You can just flip the order of calling _configure_expr_converter and _configure_command_converter - the simpler one (_configure_expr_converter) should be called first. When I do that, the output becomes:
The reason for this is that some hook factories (the attrs one being a prime example) fetch subhooks for all fields eagerly (at the time of hook creation). This is mostly for speed reasons, however it makes the order of hook creation matter. You can look at #560 (comment) for more details. We really need more docs here ;)
6.8.0-40-generic #40~22.04.3-Ubuntu
Description
Full gist: https://gist.github.com/brunokim/1545287ec50c1383c2ed9aabfcd45753
I'm using inheritance to build two type hierarchies:
Expr
andCommand
, which includesExpr
.Exprs can use the built-in field disambiguation for structuring, but there are more Commands than those in this MWE, which require a union strategy using the
tag
fieldWeirdly enough, I'm able to successfully structure fields in
Select
, whereExpr
s are within a tuple, but not inWhere
, which chooses the base emptyExpr()
type!I'd expect to see
Where(expr=Literal(value=1))
instead.What I Did
I tried walking the conversion function, and it seems that the generated Where structuring function is hardcoded to use the base Expr, instead of attempting to use the subclass dispatcher.
Thanks for any insight on what I should be doing!
The text was updated successfully, but these errors were encountered: