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