| 1 |
# These are tests for JSON vs JSON datatypes. |
| 2 |
# Comparator > |
| 3 |
#----------------------- |
| 4 |
echo "Test for JSON vs JSON"; |
| 5 |
echo ""; |
| 6 |
echo ""; |
| 7 |
|
| 8 |
--disable_query_log |
| 9 |
select |
| 10 |
a.col as side1, |
| 11 |
b.col as side2, |
| 12 |
JSON_TYPE(CAST(a.col as JSON)) as side1_json_type, |
| 13 |
JSON_TYPE(CAST(b.col as JSON)) as side2_json_type, |
| 14 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) as side1_json_weightage, |
| 15 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage, |
| 16 |
a.col > b.col as json_compare, |
| 17 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) > |
| 18 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation |
| 19 |
from jj a , jj b |
| 20 |
where a.col is not NULL |
| 21 |
and b.col is not NULL |
| 22 |
and ((a.col > b.col) != ( |
| 23 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) |
| 24 |
> |
| 25 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) |
| 26 |
))AND JSON_TYPE(CAST(a.col as JSON)) !='BLOB' |
| 27 |
AND JSON_TYPE(CAST(b.col as JSON)) !='BLOB' |
| 28 |
AND GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) != GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))); |
| 29 |
|
| 30 |
echo "Comparator <"; |
| 31 |
echo "=============="; |
| 32 |
# Comparator < |
| 33 |
#----------------------- |
| 34 |
|
| 35 |
select |
| 36 |
a.col as side1, |
| 37 |
b.col as side2, |
| 38 |
JSON_TYPE(CAST(a.col as JSON)) as side1_json_type, |
| 39 |
JSON_TYPE(CAST(b.col as JSON)) as side2_json_type, |
| 40 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) as side1_json_weightage, |
| 41 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage, |
| 42 |
a.col < b.col as json_compare, |
| 43 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) < |
| 44 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation |
| 45 |
from jj a , jj b |
| 46 |
where a.col is not NULL |
| 47 |
and b.col is not NULL |
| 48 |
and ((a.col < b.col) != ( |
| 49 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) |
| 50 |
< |
| 51 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) |
| 52 |
))AND JSON_TYPE(CAST(a.col as JSON)) !='BLOB' |
| 53 |
AND JSON_TYPE(CAST(b.col as JSON)) !='BLOB' |
| 54 |
AND GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) != GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))); |
| 55 |
|
| 56 |
echo "Comparator >="; |
| 57 |
echo "=============="; |
| 58 |
# Comparator >= |
| 59 |
#----------------------- |
| 60 |
|
| 61 |
select |
| 62 |
a.col as side1, |
| 63 |
b.col as side2, |
| 64 |
JSON_TYPE(CAST(a.col as JSON)) as side1_json_type, |
| 65 |
JSON_TYPE(CAST(b.col as JSON)) as side2_json_type, |
| 66 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) as side1_json_weightage, |
| 67 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage, |
| 68 |
a.col >= b.col as json_compare, |
| 69 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) >= |
| 70 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation |
| 71 |
from jj a , jj b |
| 72 |
where a.col is not NULL |
| 73 |
and b.col is not NULL |
| 74 |
and ((a.col >= b.col) != ( |
| 75 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) |
| 76 |
>= |
| 77 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) |
| 78 |
))AND JSON_TYPE(CAST(a.col as JSON)) !='BLOB' |
| 79 |
AND JSON_TYPE(CAST(b.col as JSON)) !='BLOB' |
| 80 |
AND GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) != GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))); |
| 81 |
|
| 82 |
echo "Comparator <="; |
| 83 |
echo "=============="; |
| 84 |
# Comparator <= |
| 85 |
#----------------------- |
| 86 |
|
| 87 |
select |
| 88 |
a.col as side1, |
| 89 |
b.col as side2, |
| 90 |
JSON_TYPE(CAST(a.col as JSON)) as side1_json_type, |
| 91 |
JSON_TYPE(CAST(b.col as JSON)) as side2_json_type, |
| 92 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) as side1_json_weightage, |
| 93 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage, |
| 94 |
a.col <= b.col as json_compare, |
| 95 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) <= |
| 96 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation |
| 97 |
from jj a , jj b |
| 98 |
where a.col is not NULL |
| 99 |
and b.col is not NULL |
| 100 |
and ((a.col <= b.col) != ( |
| 101 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) |
| 102 |
<= |
| 103 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) |
| 104 |
))AND JSON_TYPE(CAST(a.col as JSON)) !='BLOB' |
| 105 |
AND JSON_TYPE(CAST(b.col as JSON)) !='BLOB' |
| 106 |
AND GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) != GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))); |
| 107 |
|
| 108 |
echo "Comparator ="; |
| 109 |
echo "=============="; |
| 110 |
# Comparator = |
| 111 |
#----------------------- |
| 112 |
|
| 113 |
select |
| 114 |
a.col as side1, |
| 115 |
b.col as side2, |
| 116 |
JSON_TYPE(CAST(a.col as JSON)) as side1_json_type, |
| 117 |
JSON_TYPE(CAST(b.col as JSON)) as side2_json_type, |
| 118 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) as side1_json_weightage, |
| 119 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage, |
| 120 |
a.col = b.col as json_compare, |
| 121 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) = |
| 122 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation |
| 123 |
from jj a , jj b |
| 124 |
where a.col is not NULL |
| 125 |
and b.col is not NULL |
| 126 |
and ((a.col = b.col) != ( |
| 127 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) |
| 128 |
= |
| 129 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) |
| 130 |
))AND JSON_TYPE(CAST(a.col as JSON)) !='BLOB' |
| 131 |
AND JSON_TYPE(CAST(b.col as JSON)) !='BLOB' |
| 132 |
AND GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) != GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))); |
| 133 |
|
| 134 |
echo "Comparator <>"; |
| 135 |
echo "=============="; |
| 136 |
# Comparator <> |
| 137 |
#----------------------- |
| 138 |
select |
| 139 |
a.col as side1, |
| 140 |
b.col as side2, |
| 141 |
JSON_TYPE(CAST(a.col as JSON)) as side1_json_type, |
| 142 |
JSON_TYPE(CAST(b.col as JSON)) as side2_json_type, |
| 143 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) as side1_json_weightage, |
| 144 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage, |
| 145 |
a.col <> b.col as json_compare, |
| 146 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) <> |
| 147 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation |
| 148 |
from jj a , jj b |
| 149 |
where a.col is not NULL |
| 150 |
and b.col is not NULL |
| 151 |
and ((a.col <> b.col) != ( |
| 152 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) |
| 153 |
<> |
| 154 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) |
| 155 |
))AND JSON_TYPE(CAST(a.col as JSON)) !='BLOB' |
| 156 |
AND JSON_TYPE(CAST(b.col as JSON)) !='BLOB' |
| 157 |
AND GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) != GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))); |
| 158 |
|
| 159 |
echo "Comparator <=>"; |
| 160 |
echo "=============="; |
| 161 |
# Comparator <=> |
| 162 |
#----------------------- |
| 163 |
select |
| 164 |
a.col as side1, |
| 165 |
b.col as side2, |
| 166 |
JSON_TYPE(CAST(a.col as JSON)) as side1_json_type, |
| 167 |
JSON_TYPE(CAST(b.col as JSON)) as side2_json_type, |
| 168 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) as side1_json_weightage, |
| 169 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage, |
| 170 |
a.col <=> b.col as json_compare, |
| 171 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) <=> |
| 172 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation |
| 173 |
from jj a , jj b |
| 174 |
where a.col is not NULL |
| 175 |
and b.col is not NULL |
| 176 |
and ((a.col <=> b.col) != ( |
| 177 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) |
| 178 |
<=> |
| 179 |
GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) |
| 180 |
))AND JSON_TYPE(CAST(a.col as JSON)) !='BLOB' |
| 181 |
AND JSON_TYPE(CAST(b.col as JSON)) !='BLOB' |
| 182 |
AND GET_JSON_WEIGHT(JSON_TYPE(CAST(a.col as JSON))) != GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))); |