thingtalk
thingtalk copied to clipboard
Optimization for existential subquery
Existential subqueries can be optimized as operations like sorting won't affect the value of the boolean expression.
Operations that have effect:
- filter
- projection: the output parameter could be optional, the semantics is at least one row has all projections are not
null
orundefined
. - aggregation: similar to projection, as long as the fields used are not
null
orundefined
, this should be true, so this can probably be optimized to projection. - slice: the semantics is at least any of x rows are returned, where x is the length of the slice
Operations that have no effect:
- sort
- index
- argmin/argmax
- alias