Handling missing value? #363
Replies: 2 comments
-
First let's get discuss how we get rid of Aggregating expressions
This is probably most intuitive, but it is compiled to nested querries and SQL engine (especially SQLite) may get confused by it. Zero padding Zero padding pattern ends up useful in many situations in Logica. Here you make sure that aggregated column is never null by adding zero to all the keys that you expect to have. In this case there are no keys, there is a single row.
Now the easest way to turn number greater than 0 to 1 is just by applying
Tested: COLAB Let me know if you have any further questions, or desire for any improvement of this approach. |
Beta Was this translation helpful? Give feedback.
-
I was able to solve the issues based on this, thank you very much! I think it would be great if there would be generic built-ins for predicate logic "every x", "there exists x" and implication. |
Beta Was this translation helpful? Give feedback.
-
I am still struggling to implement predicate logic statement "every" with Logica.
For example:
"Every Employee who is a Manager has had ManagementTraining"
i.e.
Every Employee(x), Manager(x) -> ManagementTraining(x).
Because implication (Manager(x) -> ManagementTraining(x)) can be rewritten as ~Manager(x) or ManagementTraining(x), and I get the offending rows by negation of that, then I can check if there are zero rows the statement is true (1) or otherwise false (0).
So in SQL:
In Logica, I can do:
However, as count is implemented with sum, this gives me either the count of the offending rows but it gives None if there are no matches.
How do I turn this into 1 if c is None or 0 if c is defined in Logica?
Or is there an easier way to implement the statement in a way that is more close to the original predicate logic statement?
Beta Was this translation helpful? Give feedback.
All reactions