-
Hey Evgeniy! I'm trying to understand the aggregation behaviour and the errors I'm getting. The following snippet works fine:
However, if I make Where is this coming from? Is there something I can do better? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
I found a workaround to get what I want:
But if I change |
Beta Was this translation helpful? Give feedback.
-
Hi @rvalek , Logica tries to have a simple compiler, so user can easily control the SQL query and thus optimize their program. So any predicate must be injectible or concrete. Concrete predicate can be compiled into SQL itself. The way It is quite possible that in the future we may want to make compiler more flexible and compile programs like your original, but it wasn't done yet. Hopefully this answer makes sense. Let me know if you have further questions. |
Beta Was this translation helpful? Give feedback.
-
@rvalek thank you very much for your supportive feedback! Don't hesitate to reach out if you have further questions. |
Beta Was this translation helpful? Give feedback.
Hi @rvalek ,
yes, this works as intended and your solution is optimal.
We do need to document this better. For now I have added a brief section into the tutorial.
Logica tries to have a simple compiler, so user can easily control the SQL query and thus optimize their program.
So any predicate must be injectible or concrete.
Predicate is injectible if it is defined with a single non-aggregating rule. Such predicate is allowed to use aggregating expressions. This is exactly how you defined
AllMatching
predicate in your fix.Injectable predicates can be "injected" into predicates that call them via substitution.
Concrete predicate can be compiled into SQL itself.
The way
AllMatching
is defin…