1echo "Test for SQL vs JSON";
2echo "Comparator <";
3echo "";
4echo "Testcase for Tinyint";
5#====================
6select
7IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._tin as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
8a._tin as side1,
9b.col as side2,
10JSON_TYPE(CAST(a._tin as JSON)) as side1_json_type,
11JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
12GET_JSON_WEIGHT(JSON_TYPE(CAST(a._tin as JSON))) as side1_json_weightage,
13GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
14a._tin <  b.col as json_compare,
15GET_JSON_WEIGHT(JSON_TYPE(CAST(a._tin as JSON))) <
16GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
17from t_tin a , jj b
18where a._tin is not NULL
19and b.col is not NULL
20and JSON_TYPE(CAST(a._tin as JSON))!='BLOB'
21and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
22and ((a._tin <  b.col) != (
23GET_JSON_WEIGHT(JSON_TYPE(CAST(a._tin as JSON)))
24<
25GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
26));
27
28
29echo "Testcase for Boolean";
30#=====================
31select
32IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._boo as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
33a._boo as side1,
34b.col as side2,
35JSON_TYPE(CAST(a._boo as JSON)) as side1_json_type,
36JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
37GET_JSON_WEIGHT(JSON_TYPE(CAST(a._boo as JSON))) as side1_json_weightage,
38GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
39a._boo <  b.col as json_compare,
40GET_JSON_WEIGHT(JSON_TYPE(CAST(a._boo as JSON))) <
41GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
42from t_boo a , jj b
43where a._boo is not NULL
44and b.col is not NULL
45and JSON_TYPE(CAST(a._boo as JSON))!='BLOB'
46and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
47and ((a._boo <  b.col) != (
48GET_JSON_WEIGHT(JSON_TYPE(CAST(a._boo as JSON)))
49<
50GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
51));
52
53echo "Testcase for small Int Signed";
54#==============================
55select
56IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._sms as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
57a._sms as side1,
58b.col as side2,
59JSON_TYPE(CAST(a._sms as JSON)) as side1_json_type,
60JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
61GET_JSON_WEIGHT(JSON_TYPE(CAST(a._sms as JSON))) as side1_json_weightage,
62GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
63a._sms <  b.col as json_compare,
64GET_JSON_WEIGHT(JSON_TYPE(CAST(a._sms as JSON))) <
65GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
66from t_sms a , jj b
67where a._sms is not NULL
68and b.col is not NULL
69and JSON_TYPE(CAST(a._sms as JSON))!='BLOB'
70and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
71and ((a._sms <  b.col) != (
72GET_JSON_WEIGHT(JSON_TYPE(CAST(a._sms as JSON)))
73<
74GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
75));
76
77
78
79echo "Testcase for Signed Medium Int";
80#===============================
81select
82IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._mes as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
83a._mes as side1,
84b.col as side2,
85JSON_TYPE(CAST(a._mes as JSON)) as side1_json_type,
86JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
87GET_JSON_WEIGHT(JSON_TYPE(CAST(a._mes as JSON))) as side1_json_weightage,
88GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
89a._mes <  b.col as json_compare,
90GET_JSON_WEIGHT(JSON_TYPE(CAST(a._mes as JSON))) <
91GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
92from t_mes a , jj b
93where a._mes is not NULL
94and b.col is not NULL
95and JSON_TYPE(CAST(a._mes as JSON))!='BLOB'
96and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
97and ((a._mes <  b.col) != (
98GET_JSON_WEIGHT(JSON_TYPE(CAST(a._mes as JSON)))
99<
100GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
101));
102
103
104echo "Testcase for unsigned Medium Int";
105#==================================
106select
107IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._meu as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
108a._meu as side1,
109b.col as side2,
110JSON_TYPE(CAST(a._meu as JSON)) as side1_json_type,
111JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
112GET_JSON_WEIGHT(JSON_TYPE(CAST(a._meu as JSON))) as side1_json_weightage,
113GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
114a._meu <  b.col as json_compare,
115GET_JSON_WEIGHT(JSON_TYPE(CAST(a._meu as JSON))) <
116GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
117from t_meu a , jj b
118where a._meu is not NULL
119and b.col is not NULL
120and JSON_TYPE(CAST(a._meu as JSON))!='BLOB'
121and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
122and ((a._meu <  b.col) != (
123GET_JSON_WEIGHT(JSON_TYPE(CAST(a._meu as JSON)))
124<
125GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
126));
127
128echo "Testcase for signed Int";
129#========================
130select
131IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._ins as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
132a._ins as side1,
133b.col as side2,
134JSON_TYPE(CAST(a._ins as JSON)) as side1_json_type,
135JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
136GET_JSON_WEIGHT(JSON_TYPE(CAST(a._ins as JSON))) as side1_json_weightage,
137GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
138a._ins <  b.col as json_compare,
139GET_JSON_WEIGHT(JSON_TYPE(CAST(a._ins as JSON))) <
140GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
141from t_ins a , jj b
142where a._ins is not NULL
143and b.col is not NULL
144and ((a._ins <  b.col) != (
145GET_JSON_WEIGHT(JSON_TYPE(CAST(a._ins as JSON)))
146<
147GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
148));
149
150echo "Testcase for Unsigned Int";
151#========================
152select
153IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._inu as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
154a._inu as side1,
155b.col as side2,
156JSON_TYPE(CAST(a._inu as JSON)) as side1_json_type,
157JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
158GET_JSON_WEIGHT(JSON_TYPE(CAST(a._inu as JSON))) as side1_json_weightage,
159GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
160a._inu <  b.col as json_compare,
161GET_JSON_WEIGHT(JSON_TYPE(CAST(a._inu as JSON))) <
162GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
163from t_inu a , jj b
164where a._inu is not NULL
165and b.col is not NULL
166and JSON_TYPE(CAST(a._inu as JSON))!='BLOB'
167and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
168and ((a._inu <  b.col) != (
169GET_JSON_WEIGHT(JSON_TYPE(CAST(a._inu as JSON)))
170<
171GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
172));
173
174
175echo "Testcase for Big Int";
176#========================
177select
178IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._bis as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
179a._bis as side1,
180b.col as side2,
181JSON_TYPE(CAST(a._bis as JSON)) as side1_json_type,
182JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
183GET_JSON_WEIGHT(JSON_TYPE(CAST(a._bis as JSON))) as side1_json_weightage,
184GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
185a._bis <  b.col as json_compare,
186GET_JSON_WEIGHT(JSON_TYPE(CAST(a._bis as JSON))) <
187GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
188from t_bis a , jj b
189where a._bis is not NULL
190and b.col is not NULL
191and JSON_TYPE(CAST(a._bis as JSON))!='BLOB'
192and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
193and ((a._bis <  b.col) != (
194GET_JSON_WEIGHT(JSON_TYPE(CAST(a._bis as JSON)))
195<
196GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
197));
198
199echo "Testcase for Big Int Unsigned";
200#==============================
201select
202IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._biu as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
203a._biu as side1,
204b.col as side2,
205JSON_TYPE(CAST(a._biu as JSON)) as side1_json_type,
206JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
207GET_JSON_WEIGHT(JSON_TYPE(CAST(a._biu as JSON))) as side1_json_weightage,
208GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
209a._biu <  b.col as json_compare,
210GET_JSON_WEIGHT(JSON_TYPE(CAST(a._biu as JSON))) <
211GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
212from t_biu a , jj b
213where a._biu is not NULL
214and b.col is not NULL
215and JSON_TYPE(CAST(a._biu as JSON))!='BLOB'
216and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
217and ((a._biu <  b.col) != (
218GET_JSON_WEIGHT(JSON_TYPE(CAST(a._biu as JSON)))
219<
220GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
221));
222
223echo "Testcase for Decimal";
224#=====================
225select
226IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._dec as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
227a._dec as side1,
228b.col as side2,
229JSON_TYPE(CAST(a._dec as JSON)) as side1_json_type,
230JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
231GET_JSON_WEIGHT(JSON_TYPE(CAST(a._dec as JSON))) as side1_json_weightage,
232GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
233a._dec <  b.col as json_compare,
234GET_JSON_WEIGHT(JSON_TYPE(CAST(a._dec as JSON))) <
235GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
236from t_dec a , jj b
237where a._dec is not NULL
238and b.col is not NULL
239and JSON_TYPE(CAST(a._dec as JSON))!='BLOB'
240and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
241and ((a._dec <  b.col) != (
242GET_JSON_WEIGHT(JSON_TYPE(CAST(a._dec as JSON)))
243<
244GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
245));
246
247echo "Testcase for Double";
248#=====================
249select
250IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._dou as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
251a._dou as side1,
252b.col as side2,
253JSON_TYPE(CAST(a._dou as JSON)) as side1_json_type,
254JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
255GET_JSON_WEIGHT(JSON_TYPE(CAST(a._dou as JSON))) as side1_json_weightage,
256GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
257a._dou <  b.col as json_compare,
258GET_JSON_WEIGHT(JSON_TYPE(CAST(a._dou as JSON))) <
259GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
260from t_dou a , jj b
261where a._dou is not NULL
262and b.col is not NULL
263and JSON_TYPE(CAST(a._dou as JSON))!='BLOB'
264and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
265and ((a._dou <  b.col) != (
266GET_JSON_WEIGHT(JSON_TYPE(CAST(a._dou as JSON)))
267<
268GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
269));
270
271echo "Testcase for CHAR";
272#===================
273select
274IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._chr as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
275a._chr as side1,
276b.col as side2,
277JSON_TYPE(CAST(a._chr as JSON)) as side1_json_type,
278JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
279GET_JSON_WEIGHT(JSON_TYPE(CAST(a._chr as JSON))) as side1_json_weightage,
280GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
281a._chr <  b.col as json_compare,
282GET_JSON_WEIGHT(JSON_TYPE(CAST(a._chr as JSON))) <
283GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
284from t_chr a , jj b
285where a._chr is not NULL
286and b.col is not NULL
287and JSON_TYPE(CAST(a._chr as JSON))!='BLOB'
288and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
289and ((a._chr <  b.col) != (
290GET_JSON_WEIGHT(JSON_TYPE(CAST(a._chr as JSON)))
291<
292GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
293));
294
295echo "Testcase for VARCHAR";
296#=====================
297
298select
299IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._vch as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
300a._vch as side1,
301b.col as side2,
302JSON_TYPE(CAST(a._vch as JSON)) as side1_json_type,
303JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
304GET_JSON_WEIGHT(JSON_TYPE(CAST(a._vch as JSON))) as side1_json_weightage,
305GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
306a._vch <  b.col as json_compare,
307GET_JSON_WEIGHT(JSON_TYPE(CAST(a._vch as JSON))) <
308GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
309from t_vch a , jj b
310where a._vch is not NULL
311and b.col is not NULL
312and JSON_TYPE(CAST(a._vch as JSON))!='BLOB'
313and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
314and ((a._vch <  b.col) != (
315GET_JSON_WEIGHT(JSON_TYPE(CAST(a._vch as JSON)))
316<
317GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
318));
319
320echo "Testcase for Binary(255)";
321#==========================
322
323select
324IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._bin as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
325a._bin as side1,
326b.col as side2,
327JSON_TYPE(CAST(a._bin as JSON)) as side1_json_type,
328JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
329GET_JSON_WEIGHT(JSON_TYPE(CAST(a._bin as JSON))) as side1_json_weightage,
330GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
331a._bin <  b.col as json_compare,
332GET_JSON_WEIGHT(JSON_TYPE(CAST(a._bin as JSON))) <
333GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
334from t_bin a , jj b
335where a._bin is not NULL
336and b.col is not NULL
337and JSON_TYPE(CAST(a._bin as JSON))!='BLOB'
338and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
339and ((a._bin <  b.col) != (
340GET_JSON_WEIGHT(JSON_TYPE(CAST(a._bin as JSON)))
341<
342GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
343));
344
345
346echo "Testcase for Variable Binary";
347#=============================
348select
349IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._vbn as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
350a._vbn as side1,
351b.col as side2,
352JSON_TYPE(CAST(a._vbn as JSON)) as side1_json_type,
353JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
354GET_JSON_WEIGHT(JSON_TYPE(CAST(a._vbn as JSON))) as side1_json_weightage,
355GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
356a._vbn <  b.col as json_compare,
357GET_JSON_WEIGHT(JSON_TYPE(CAST(a._vbn as JSON))) <
358GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
359from t_vbn a , jj b
360where a._vbn is not NULL
361and b.col is not NULL
362and JSON_TYPE(CAST(a._vbn as JSON))!='BLOB'
363and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
364and ((a._vbn <  b.col) != (
365GET_JSON_WEIGHT(JSON_TYPE(CAST(a._vbn as JSON)))
366<
367GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
368));
369
370echo "Testcase for TinyBlob";
371#======================
372select
373IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._tbl as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
374a._tbl as side1,
375b.col as side2,
376JSON_TYPE(CAST(a._tbl as JSON)) as side1_json_type,
377JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
378GET_JSON_WEIGHT(JSON_TYPE(CAST(a._tbl as JSON))) as side1_json_weightage,
379GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
380a._tbl <  b.col as json_compare,
381GET_JSON_WEIGHT(JSON_TYPE(CAST(a._tbl as JSON))) <
382GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
383from t_tbl a , jj b
384where a._tbl is not NULL
385and b.col is not NULL
386and JSON_TYPE(CAST(a._tbl as JSON))!='BLOB'
387and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
388and ((a._tbl <  b.col) != (
389GET_JSON_WEIGHT(JSON_TYPE(CAST(a._tbl as JSON)))
390<
391GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
392));
393
394echo "Testcase for TinyText";
395#======================
396select
397IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._ttx as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
398a._ttx as side1,
399b.col as side2,
400JSON_TYPE(CAST(a._ttx as JSON)) as side1_json_type,
401JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
402GET_JSON_WEIGHT(JSON_TYPE(CAST(a._ttx as JSON))) as side1_json_weightage,
403GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
404a._ttx <  b.col as json_compare,
405GET_JSON_WEIGHT(JSON_TYPE(CAST(a._ttx as JSON))) <
406GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
407from t_ttx a , jj b
408where a._ttx is not NULL
409and b.col is not NULL
410and JSON_TYPE(CAST(a._ttx as JSON))!='BLOB'
411and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
412and ((a._ttx <  b.col) != (
413GET_JSON_WEIGHT(JSON_TYPE(CAST(a._ttx as JSON)))
414<
415GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
416));
417
418echo "Testcase for Blob";
419#======================
420select
421IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._blb as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
422a._blb as side1,
423b.col as side2,
424JSON_TYPE(CAST(a._blb as JSON)) as side1_json_type,
425JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
426GET_JSON_WEIGHT(JSON_TYPE(CAST(a._blb as JSON))) as side1_json_weightage,
427GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
428a._blb <  b.col as json_compare,
429GET_JSON_WEIGHT(JSON_TYPE(CAST(a._blb as JSON))) <
430GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
431from t_blb a , jj b
432where a._blb is not NULL
433and b.col is not NULL
434and JSON_TYPE(CAST(a._blb as JSON))!='BLOB'
435and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
436and ((a._blb <  b.col) != (
437GET_JSON_WEIGHT(JSON_TYPE(CAST(a._blb as JSON)))
438<
439GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
440));
441
442
443echo "Testcase for Text";
444#======================
445select
446IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._txt as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
447a._txt as side1,
448b.col as side2,
449JSON_TYPE(CAST(a._txt as JSON)) as side1_json_type,
450JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
451GET_JSON_WEIGHT(JSON_TYPE(CAST(a._txt as JSON))) as side1_json_weightage,
452GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
453a._txt <  b.col as json_compare,
454GET_JSON_WEIGHT(JSON_TYPE(CAST(a._txt as JSON))) <
455GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
456from t_txt a , jj b
457where a._txt is not NULL
458and b.col is not NULL
459and JSON_TYPE(CAST(a._txt as JSON))!='BLOB'
460and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
461and ((a._txt <  b.col) != (
462GET_JSON_WEIGHT(JSON_TYPE(CAST(a._txt as JSON)))
463<
464GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
465));
466
467echo "Testcase for Medium Blob";
468#=========================
469select
470IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._mbb as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
471a._mbb as side1,
472b.col as side2,
473JSON_TYPE(CAST(a._mbb as JSON)) as side1_json_type,
474JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
475GET_JSON_WEIGHT(JSON_TYPE(CAST(a._mbb as JSON))) as side1_json_weightage,
476GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
477a._mbb <  b.col as json_compare,
478GET_JSON_WEIGHT(JSON_TYPE(CAST(a._mbb as JSON))) <
479GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
480from t_mbb a , jj b
481where a._mbb is not NULL
482and b.col is not NULL
483and JSON_TYPE(CAST(a._mbb as JSON))!='BLOB'
484and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
485and ((a._mbb <  b.col) != (
486GET_JSON_WEIGHT(JSON_TYPE(CAST(a._mbb as JSON)))
487<
488GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
489));
490
491echo "Testcase for Medium Text";
492#=========================
493select
494IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._mtx as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
495a._mtx as side1,
496b.col as side2,
497JSON_TYPE(CAST(a._mtx as JSON)) as side1_json_type,
498JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
499GET_JSON_WEIGHT(JSON_TYPE(CAST(a._mtx as JSON))) as side1_json_weightage,
500GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
501a._mtx <  b.col as json_compare,
502GET_JSON_WEIGHT(JSON_TYPE(CAST(a._mtx as JSON))) <
503GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
504from t_mtx a , jj b
505where a._mtx is not NULL
506and b.col is not NULL
507and JSON_TYPE(CAST(a._mtx as JSON))!='BLOB'
508and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
509and ((a._mtx <  b.col) != (
510GET_JSON_WEIGHT(JSON_TYPE(CAST(a._mtx as JSON)))
511<
512GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
513));
514
515echo "Testcase for Long Blob";
516#=========================
517select
518IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._lbb as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
519a._lbb as side1,
520b.col as side2,
521JSON_TYPE(CAST(a._lbb as JSON)) as side1_json_type,
522JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
523GET_JSON_WEIGHT(JSON_TYPE(CAST(a._lbb as JSON))) as side1_json_weightage,
524GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
525a._lbb <  b.col as json_compare,
526GET_JSON_WEIGHT(JSON_TYPE(CAST(a._lbb as JSON))) <
527GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
528from t_lbb a , jj b
529where a._lbb is not NULL
530and b.col is not NULL
531and JSON_TYPE(CAST(a._lbb as JSON))!='BLOB'
532and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
533and ((a._lbb <  b.col) != (
534GET_JSON_WEIGHT(JSON_TYPE(CAST(a._lbb as JSON)))
535<
536GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
537));
538
539echo "Testcase for Long Text";
540#=========================
541select
542IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._ltx as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
543a._ltx as side1,
544b.col as side2,
545JSON_TYPE(CAST(a._ltx as JSON)) as side1_json_type,
546JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
547GET_JSON_WEIGHT(JSON_TYPE(CAST(a._ltx as JSON))) as side1_json_weightage,
548GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
549a._ltx <  b.col as json_compare,
550GET_JSON_WEIGHT(JSON_TYPE(CAST(a._ltx as JSON))) <
551GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
552from t_ltx a , jj b
553where a._ltx is not NULL
554and b.col is not NULL
555and JSON_TYPE(CAST(a._ltx as JSON))!='BLOB'
556and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
557and ((a._ltx <  b.col) != (
558GET_JSON_WEIGHT(JSON_TYPE(CAST(a._ltx as JSON)))
559<
560GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
561));
562
563echo "Testcase for Enum";
564#==================
565select
566IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._enu as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
567a._enu as side1,
568b.col as side2,
569JSON_TYPE(CAST(a._enu as JSON)) as side1_json_type,
570JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
571GET_JSON_WEIGHT(JSON_TYPE(CAST(a._enu as JSON))) as side1_json_weightage,
572GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
573a._enu <  b.col as json_compare,
574GET_JSON_WEIGHT(JSON_TYPE(CAST(a._enu as JSON))) <
575GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
576from t_enu a , jj b
577where a._enu is not NULL
578and b.col is not NULL
579and JSON_TYPE(CAST(a._enu as JSON))!='BLOB'
580and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
581and ((a._enu <  b.col) != (
582GET_JSON_WEIGHT(JSON_TYPE(CAST(a._enu as JSON)))
583<
584GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
585));
586
587echo "Testcase for Set";
588#==================
589select
590IF(GET_JSON_WEIGHT(JSON_TYPE(CAST(a._set as JSON)))=GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))),'2nd Level','1st Level') validation_stage,
591a._set as side1,
592b.col as side2,
593JSON_TYPE(CAST(a._set as JSON)) as side1_json_type,
594JSON_TYPE(CAST(b.col as JSON)) as side2_json_type,
595GET_JSON_WEIGHT(JSON_TYPE(CAST(a._set as JSON))) as side1_json_weightage,
596GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as side2_json_weightage,
597a._set <  b.col as json_compare,
598GET_JSON_WEIGHT(JSON_TYPE(CAST(a._set as JSON))) <
599GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON))) as first_level_validation
600from t_set a , jj b
601where a._set is not NULL
602and b.col is not NULL
603and JSON_TYPE(CAST(a._set as JSON))!='BLOB'
604and JSON_TYPE(CAST(b.col as JSON))!='BLOB'
605and ((a._set <  b.col) != (
606GET_JSON_WEIGHT(JSON_TYPE(CAST(a._set as JSON)))
607<
608GET_JSON_WEIGHT(JSON_TYPE(CAST(b.col as JSON)))
609));
610