Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sql: fix JSON fetch value operator evaluation
This commit fixes incorrect evaluation of the JSON fetch value operator, `->`. There were two bugs causing incorrect evaluation. The first issue was a result of optimizer normalization rules that produced unequivalent scalar expressions when converting `->` to `@>`. The rules would convert expressions like `j -> '"a"' = 1` to `j @> '{"a": 1}'`. This is invalid because `->` results in `NULL` when the LHS does not contain the RHS key, but the resulting `@>` expression is always either `true` or `false`, never `NULL`. These normalization rules have been removed. These two rules existed to provide inverted index-acceleration for queries with `->`, because the optimizer can only index-accerlate `@>` operators during exploration. As a result of their removal, queries with `->` operators are no longer index-accelerated. This will be remedied in a future commit. The second issue was a bug in the vectorized overload of the `->` operator. Previously, when the operator evaluated to `NULL` with two non-`NULL` inputs, the resulting `NULL` would not be tracked by the `Nulls` struct. Fixes cockroachdb#49143 Release note (bug fix): Previously, the JSON fetch value operator, `->`, would evaluate incorrectly in some cases. This has been fixed.
- Loading branch information