-
Notifications
You must be signed in to change notification settings - Fork 29
WIP: Expr support getfield #392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
b99aba3
to
94eefad
Compare
expr = { | ||
"$expr": { | ||
"$gt": [ | ||
{"$getField": {"input": "$price", "field": "value"}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we optimize this down to remove the $getField
when the field names don't contain $
or .
? Something like:
{
"$match": {
"$expr": {
"$gt": ["$price.value", "$discounted_price.value"]
}
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could. I'm trying to think if there's any case where this would be an issue if it mistakenly resolved it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would have to be a two-phase conversion. I think it may even be best to still change it in our actual query code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming here that this change ends up being needed. Holding off until we either get customer complaints or the refactor can't solve this makes more sense to me for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I tried to make it work (and I think I managed to), but the silent mutation of $getField
to $field
is worrying to me. Even if I manage to make things pass tests, it just feels out of scope of the optimizers goal, which is to explicitly change things from $expr
to $match
.
TODO