@@ -117,18 +117,18 @@ yy.Select.prototype.compileGroup = function (query) {
117117 if ( 'funcid' in col . expression ) {
118118 let colexp1 = colExpIfFunIdExists ( col . expression ) ;
119119
120- return `'${ colas } ': (typeof ${ colexp1 } == 'number' ? ${ colexp } : typeof ${ colexp1 } == 'object' ?
120+ return `'${ colas } ': (typeof ${ colexp1 } == 'number' || typeof ${ colexp1 } == 'bigint' ? ${ colexp } : typeof ${ colexp1 } == 'object' ?
121121 typeof Number(${ colexp1 } ) == 'number' && ${ colexp1 } !== null? ${ colexp } : null : null),` ;
122122 }
123- return `'${ colas } ': (typeof ${ colexp } == 'number' ? ${ colexp } : typeof ${ colexp } == 'object' ?
123+ return `'${ colas } ': (typeof ${ colexp } == 'number' || typeof ${ colexp } == 'bigint' ? ${ colexp } : typeof ${ colexp } == 'object' ?
124124 typeof Number(${ colexp } ) == 'number' && ${ colexp } !== null? ${ colexp } : null : null),` ;
125125 } else if ( col . aggregatorid === 'MAX' ) {
126126 if ( 'funcid' in col . expression ) {
127127 let colexp1 = colExpIfFunIdExists ( col . expression ) ;
128- return `'${ colas } ' : (typeof ${ colexp1 } == 'number' ? ${ colexp } : typeof ${ colexp1 } == 'object' ?
128+ return `'${ colas } ' : (typeof ${ colexp1 } == 'number' || typeof ${ colexp1 } == 'bigint' ? ${ colexp } : typeof ${ colexp1 } == 'object' ?
129129 typeof Number(${ colexp1 } ) == 'number' ? ${ colexp } : null : null),` ;
130130 }
131- return `'${ colas } ' : (typeof ${ colexp } == 'number' ? ${ colexp } : typeof ${ colexp } == 'object' ?
131+ return `'${ colas } ' : (typeof ${ colexp } == 'number' || typeof ${ colexp } == 'bigint' ? ${ colexp } : typeof ${ colexp } == 'object' ?
132132 typeof Number(${ colexp } ) == 'number' ? ${ colexp } : null : null),` ;
133133 } else if ( col . aggregatorid === 'ARRAY' ) {
134134 return `'${ colas } ':[${ colexp } ],` ;
@@ -183,10 +183,13 @@ yy.Select.prototype.compileGroup = function (query) {
183183 {
184184 const __g_colas = g['${ colas } '];
185185 const __typeof_colexp1 = typeof ${ colexp1 } ;
186+ const __colexp1 = ${ colexp1 } ;
186187
187188 if (__g_colas == null && ${ colexp1 } == null) {
188189 g['${ colas } '] = null;
189- } else if ((typeof __g_colas !== 'object' && typeof __g_colas !== 'number' && __typeof_colexp1 !== 'object' && __typeof_colexp1 !== 'number') ||
190+ } else if (typeof __g_colas === 'bigint' || typeof __colexp1 === 'bigint') {
191+ g['${ colas } '] = BigInt(__g_colas) + BigInt(__colexp);
192+ } else if ((typeof __g_colas !== 'object' && typeof __g_colas !== 'number' && __typeof_colexp1 !== 'object' && __typeof_colexp1 !== 'number') ||
190193 (__g_colas == null || (typeof __g_colas !== 'number' && typeof __g_colas !== 'object')) && (${ colexp1 } == null || (__typeof_colexp1 !== 'number' && __typeof_colexp1 !== 'object'))) {
191194 g['${ colas } '] = null;
192195 } else if ((typeof __g_colas !== 'object' && typeof __g_colas !== 'number' && __typeof_colexp1 == 'number') ||
@@ -208,10 +211,13 @@ yy.Select.prototype.compileGroup = function (query) {
208211 {
209212 const __g_colas = g['${ colas } '];
210213 const __typeof_colexp = typeof ${ colexp } ;
214+ const __colexp = ${ colexp } ;
211215
212216 if (__g_colas == null && ${ colexp } == null) {
213217 g['${ colas } '] = null;
214- } else if ((typeof __g_colas !== 'object' && typeof __g_colas !== 'number' && __typeof_colexp !== 'object' && __typeof_colexp !== 'number') ||
218+ } else if (typeof __g_colas === 'bigint' || typeof __colexp === 'bigint') {
219+ g['${ colas } '] = BigInt(__g_colas) + BigInt(__colexp);
220+ } else if ((typeof __g_colas !== 'object' && typeof __g_colas !== 'number' && __typeof_colexp !== 'object' && __typeof_colexp !== 'number') ||
215221 (__g_colas == null || (typeof __g_colas !== 'number' && typeof __g_colas !== 'object')) && (${ colexp } == null || (__typeof_colexp !== 'number' && __typeof_colexp !== 'object'))) {
216222 g['${ colas } '] = null;
217223 } else if (typeof __g_colas !== 'object' && typeof __g_colas !== 'number' && __typeof_colexp == 'number') {
@@ -241,7 +247,9 @@ yy.Select.prototype.compileGroup = function (query) {
241247 if (__typeof_g_colas == 'string' && !isNaN(__g_colas) && typeof Number(__g_colas) == 'number' &&
242248 __typeof_colexp1 == 'string' && !isNaN(__colexp1) && typeof Number(__colexp1) == 'number') {
243249 g['${ colas } '] = Number(__g_colas) + Number(__colexp1);
244- } else if (__typeof_g_colas == 'string' && __typeof_colexp1 == 'string') {
250+ } else if (__typeof_g_colas === 'bigint' || __typeof_colexp1 === 'bigint') {
251+ g['${ colas } '] = BigInt(__g_colas || 0) + BigInt(__colexp1 || 0);
252+ } else if (__typeof_g_colas == 'string' && __typeof_colexp1 == 'string') {
245253 g['${ colas } '] = 0;
246254 } else if (__typeof_g_colas == 'string' && __typeof_colexp1 == 'number') {
247255 g['${ colas } '] = __colexp1;
@@ -265,7 +273,9 @@ yy.Select.prototype.compileGroup = function (query) {
265273 if (__typeof_g_colas === 'string' && !isNaN(__g_colas) && typeof Number(__g_colas) === 'number' &&
266274 __typeof_colexp === 'string' && !isNaN(__colexp) && typeof Number(__colexp) === 'number') {
267275 g['${ colas } '] = Number(__g_colas) + Number(__colexp);
268- } else if (__typeof_g_colas === 'string' && __typeof_colexp === 'string') {
276+ } else if (__typeof_g_colas === 'bigint' || __typeof_colexp === 'bigint') {
277+ g['${ colas } '] = BigInt(__g_colas || 0) + BigInt(__colexp || 0);
278+ } else if (__typeof_g_colas === 'string' && __typeof_colexp === 'string') {
269279 g['${ colas } '] = 0;
270280 } else if (__typeof_g_colas === 'string' && __typeof_colexp === 'number') {
271281 g['${ colas } '] = __colexp;
@@ -296,23 +306,41 @@ yy.Select.prototype.compileGroup = function (query) {
296306 let colexp1 = colExpIfFunIdExists ( col . expression ) ;
297307 return (
298308 pre +
299- `if((g['${ colas } '] == null && ${ colexp1 } !== null) ? y = ${ colexp } : (g['${ colas } ']!== null &&
300- ${ colexp1 } == null) ? y = g['${ colas } ']:((y=${ colexp } ) < g['${ colas } '])){ if(typeof y == 'number')
301- {g['${ colas } '] = y;}else if(typeof y == 'object' && y instanceof Date){g['${ colas } '] = y;}
302- else if(typeof y == 'object' && typeof Number(y) == 'number'){g['${ colas } '] = Number(y);}}
303- else if(g['${ colas } ']!== null && typeof g['${ colas } '] == 'object' && y instanceof Date){g['${ colas } '] = g['${ colas } ']}
304- else if(g['${ colas } ']!== null && typeof g['${ colas } '] == 'object'){g['${ colas } '] = Number(g['${ colas } '])}` +
309+ `if ((g['${ colas } '] == null && ${ colexp1 } !== null) ? y = ${ colexp } :
310+ (g['${ colas } '] !== null && ${ colexp1 } == null) ? y = g['${ colas } '] :
311+ ((y = ${ colexp } ) < g['${ colas } '])) {
312+ if (typeof y == 'number' || typeof y == 'bigint') {
313+ g['${ colas } '] = y;
314+ } else if (typeof y == 'object' && y instanceof Date) {
315+ g['${ colas } '] = y;
316+ } else if (typeof y == 'object' && typeof Number(y) == 'number') {
317+ g['${ colas } '] = Number(y);
318+ }
319+ } else if (g['${ colas } '] !== null && typeof g['${ colas } '] == 'object' && y instanceof Date) {
320+ g['${ colas } '] = g['${ colas } '];
321+ } else if (g['${ colas } '] !== null && typeof g['${ colas } '] == 'object') {
322+ g['${ colas } '] = Number(g['${ colas } ']);
323+ }` +
305324 post
306325 ) ;
307326 }
308327 return (
309328 pre +
310- `if((g['${ colas } '] == null && ${ colexp } !== null) ? y = ${ colexp } : (g['${ colas } ']!== null &&
311- ${ colexp } == null) ? y = g['${ colas } ']:((y=${ colexp } ) < g['${ colas } '])){ if(typeof y == 'number')
312- {g['${ colas } '] = y;}else if(typeof y == 'object' && y instanceof Date){g['${ colas } '] = y;}
313- else if(typeof y == 'object' && typeof Number(y) == 'number'){g['${ colas } '] = Number(y);}}
314- else if(g['${ colas } ']!== null && typeof g['${ colas } '] == 'object' && y instanceof Date){g['${ colas } '] = g['${ colas } ']}
315- else if(g['${ colas } ']!== null && typeof g['${ colas } '] == 'object'){g['${ colas } '] = Number(g['${ colas } '])}` +
329+ `if((g['${ colas } '] == null && ${ colexp } !== null) ? y = ${ colexp } :
330+ (g['${ colas } ']!== null && ${ colexp } == null) ? y = g['${ colas } '] :
331+ ((y=${ colexp } ) < g['${ colas } '])) {
332+ if(typeof y == 'number' || typeof y == 'bigint') {
333+ g['${ colas } '] = y;
334+ } else if(typeof y == 'object' && y instanceof Date) {
335+ g['${ colas } '] = y;
336+ } else if(typeof y == 'object' && typeof Number(y) == 'number') {
337+ g['${ colas } '] = Number(y);
338+ }
339+ } else if(g['${ colas } ']!== null && typeof g['${ colas } '] == 'object' && y instanceof Date) {
340+ g['${ colas } '] = g['${ colas } '];
341+ } else if(g['${ colas } ']!== null && typeof g['${ colas } '] == 'object') {
342+ g['${ colas } '] = Number(g['${ colas } ']);
343+ }` +
316344 post
317345 ) ;
318346 } else if ( col . aggregatorid === 'MAX' ) {
@@ -321,23 +349,41 @@ yy.Select.prototype.compileGroup = function (query) {
321349 //console.log(pre + 'if ((y=' + colexp + ") > g['" + colas + "']) g['" + colas + "'])
322350 return (
323351 pre +
324- `if((g['${ colas } '] == null && ${ colexp1 } !== null) ? y = ${ colexp } : (g['${ colas } ']!== null &&
325- ${ colexp1 } == null) ? y = g['${ colas } ']:((y=${ colexp } ) > g['${ colas } '])){ if(typeof y == 'number')
326- {g['${ colas } '] = y;}else if(typeof y == 'object' && y instanceof Date){g['${ colas } '] = y;}
327- else if(typeof y == 'object' && typeof Number(y) == 'number'){g['${ colas } '] = Number(y);}}
328- else if(g['${ colas } ']!== null && typeof g['${ colas } '] == 'object' && y instanceof Date){g['${ colas } '] = g['${ colas } ']}
329- else if(g['${ colas } ']!== null && typeof g['${ colas } '] == 'object'){g['${ colas } '] = Number(g['${ colas } '])}` +
352+ `if ((g['${ colas } '] == null && ${ colexp1 } !== null) ? y = ${ colexp } :
353+ (g['${ colas } '] !== null && ${ colexp1 } == null) ? y = g['${ colas } '] :
354+ ((y = ${ colexp } ) > g['${ colas } '])) {
355+ if (typeof y == 'number' || typeof y == 'bigint') {
356+ g['${ colas } '] = y;
357+ } else if (typeof y == 'object' && y instanceof Date) {
358+ g['${ colas } '] = y;
359+ } else if (typeof y == 'object' && typeof Number(y) == 'number') {
360+ g['${ colas } '] = Number(y);
361+ }
362+ } else if (g['${ colas } '] !== null && typeof g['${ colas } '] == 'object' && y instanceof Date) {
363+ g['${ colas } '] = g['${ colas } '];
364+ } else if (g['${ colas } '] !== null && typeof g['${ colas } '] == 'object') {
365+ g['${ colas } '] = Number(g['${ colas } ']);
366+ }` +
330367 post
331368 ) ;
332369 }
333370 return (
334371 pre +
335- `if((g['${ colas } '] == null && ${ colexp } !== null) ? y = ${ colexp } : (g['${ colas } ']!== null &&
336- ${ colexp } == null) ? y = g['${ colas } ']:((y=${ colexp } ) > g['${ colas } '])){ if(typeof y == 'number')
337- {g['${ colas } '] = y;}else if(typeof y == 'object' && y instanceof Date){g['${ colas } '] = y;}
338- else if(typeof y == 'object' && typeof Number(y) == 'number'){g['${ colas } '] = Number(y);}}
339- else if(g['${ colas } ']!== null && typeof g['${ colas } '] == 'object' && y instanceof Date){g['${ colas } '] = g['${ colas } ']}
340- else if(g['${ colas } ']!== null && typeof g['${ colas } '] == 'object'){g['${ colas } '] = Number(g['${ colas } '])}` +
372+ `if((g['${ colas } '] == null && ${ colexp } !== null) ? y = ${ colexp } :
373+ (g['${ colas } ']!== null && ${ colexp } == null) ? y = g['${ colas } '] :
374+ ((y=${ colexp } ) > g['${ colas } '])) {
375+ if(typeof y == 'number' || typeof y == 'bigint') {
376+ g['${ colas } '] = y;
377+ } else if(typeof y == 'object' && y instanceof Date) {
378+ g['${ colas } '] = y;
379+ } else if(typeof y == 'object' && typeof Number(y) == 'number') {
380+ g['${ colas } '] = Number(y);
381+ }
382+ } else if(g['${ colas } ']!== null && typeof g['${ colas } '] == 'object' && y instanceof Date) {
383+ g['${ colas } '] = g['${ colas } '];
384+ } else if(g['${ colas } ']!== null && typeof g['${ colas } '] == 'object') {
385+ g['${ colas } '] = Number(g['${ colas } ']);
386+ }` +
341387 post
342388 ) ;
343389 } else if ( col . aggregatorid === 'FIRST' ) {
@@ -346,9 +392,16 @@ yy.Select.prototype.compileGroup = function (query) {
346392 return `${ pre } g['${ colas } ']=${ colexp } ;${ post } ` ;
347393 } else if ( col . aggregatorid === 'AVG' ) {
348394 return `${ pre }
349- g['_SUM_ ${ colas } '] + = (y= ${ colexp } )||0 ;
395+ y = (${ colexp } );
350396 g['_COUNT_${ colas } '] += (typeof y == "undefined" || y === null) ? 0 : 1;
351- g['${ colas } ']=g['_SUM_${ colas } '] / g['_COUNT_${ colas } '];
397+ if (typeof g['_SUM_${ colas } '] === 'bigint' || typeof y === 'bigint') {
398+ g['_SUM_${ colas } '] = BigInt(g['_SUM_${ colas } ']);
399+ g['_SUM_${ colas } '] += BigInt(y || 0);
400+ g['${ colas } '] = BigInt(g['_SUM_${ colas } ']) / BigInt(g['_COUNT_${ colas } ']);
401+ } else {
402+ g['_SUM_${ colas } '] += (y || 0);
403+ g['${ colas } '] = g['_SUM_${ colas } '] / g['_COUNT_${ colas } '];
404+ }
352405 ${ post } ` ;
353406 } else if ( col . aggregatorid === 'AGGR' ) {
354407 return `${ pre }
0 commit comments