github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/sql/opt/idxconstraint/testdata/inverted (about) 1 index-constraints vars=(jsonb) inverted-index=@1 2 @1 @> '{"a": 1}' 3 ---- 4 [/'{"a": 1}' - /'{"a": 1}'] 5 6 index-constraints vars=(jsonb) inverted-index=@1 7 @1 @> '{"a": 1, "b": 2}' 8 ---- 9 [/'{"a": 1}' - /'{"a": 1}'] 10 Remaining filter: @1 @> '{"a": 1, "b": 2}' 11 12 index-constraints vars=(jsonb) inverted-index=@1 13 @1 @> '{"a": {"b": 1}, "c": 2}' 14 ---- 15 [/'{"a": {"b": 1}}' - /'{"a": {"b": 1}}'] 16 Remaining filter: @1 @> '{"a": {"b": 1}, "c": 2}' 17 18 index-constraints vars=(jsonb) inverted-index=@1 19 @1 @> '{"a": {}, "c": 2}' 20 ---- 21 [/'{"c": 2}' - /'{"c": 2}'] 22 Remaining filter: @1 @> '{"a": {}, "c": 2}' 23 24 index-constraints vars=(jsonb) inverted-index=@1 25 '{"a": 1}' <@ @1 26 ---- 27 [/'{"a": 1}' - /'{"a": 1}'] 28 29 # Currently we only generate spans from one of the @> expressions. 30 index-constraints vars=(jsonb) inverted-index=@1 31 @1 @> '{"a": 1}' AND @1 @> '{"b": 1}' 32 ---- 33 [/'{"a": 1}' - /'{"a": 1}'] 34 Remaining filter: @1 @> '{"b": 1}' 35 36 index-constraints vars=(jsonb) inverted-index=@1 37 '{"a": 1}' <@ @1 AND '{"b": 1}' <@ @1 38 ---- 39 [/'{"a": 1}' - /'{"a": 1}'] 40 Remaining filter: @1 @> '{"b": 1}' 41 42 index-constraints vars=(jsonb, int) inverted-index=@1 43 @2 = 1 AND @1 @> '{"a": 1}' AND @1 @> '{"b": 1}' 44 ---- 45 [/'{"a": 1}' - /'{"a": 1}'] 46 Remaining filter: (@2 = 1) AND (@1 @> '{"b": 1}') 47 48 index-constraints vars=(int[]) inverted-index=@1 49 @1 @> ARRAY[1] 50 ---- 51 [/ARRAY[1] - /ARRAY[1]] 52 53 index-constraints vars=(int[]) inverted-index=@1 54 ARRAY[1] <@ @1 55 ---- 56 [/ARRAY[1] - /ARRAY[1]] 57 58 index-constraints vars=(int[]) inverted-index=@1 59 @1 @> ARRAY[1,2] 60 ---- 61 [/ARRAY[1] - /ARRAY[1]] 62 Remaining filter: @1 @> ARRAY[1,2] 63 64 # Currently we only generate spans from one of the @> expressions. 65 index-constraints vars=(int[]) inverted-index=@1 66 @1 @> ARRAY[1] AND @1 @> ARRAY[2] 67 ---- 68 [/ARRAY[1] - /ARRAY[1]] 69 Remaining filter: @1 @> ARRAY[2] 70 71 # This could be better - @1 @> ARRAY[] is always true, but we currently 72 # don't remove the extra filter. 73 index-constraints vars=(int[]) inverted-index=@1 74 @1 @> ARRAY[]::INT[] 75 ---- 76 [ - ] 77 Remaining filter: @1 @> ARRAY[] 78 79 # Arrays never contain ARRAY[NULL,...] 80 index-constraints vars=(int[]) inverted-index=@1 81 @1 @> ARRAY[NULL]::INT[] 82 ---- 83 84 index-constraints vars=(int[]) inverted-index=@1 85 @1 @> ARRAY[1, NULL]::INT[] 86 ---- 87 88 index-constraints vars=(int[]) inverted-index=@1 89 @1 @> ARRAY[NULL, 1]::INT[] 90 ---- 91 92 # NOTE: this should be a contradiction, but the test harness strips the 93 # constraint out too early by accident, I think. 94 index-constraints vars=(int[]) inverted-index=@1 95 @1 @> NULL 96 ---- 97 [ - ] 98 Remaining filter: NULL