-
Type: Task
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:
-
Query Optimization
Currently, collection validator expressions are not optimized. In theory, it would not be a breaking change to optimize these expressions as MatchExpression::optimize() produces a semantically equivalent expression. However, some work would need to be done to ensure that validation error generation works properly when optimize() gets called. More precisely, we would need to store two copies of the MatchExpression: the original and the optimized one. While the optimized one would be used for matching, the unoptimized one would be used to produce detailed validation errors. This extra copy of the original is necessary because the optimized expression is not guaranteed to match the original shape of the user-specified validator expression and would potentially produce an incorrect error.