@@ -433,6 +433,116 @@ describe.skipIf(shouldSkip)('S3 Integration Tests', () => {
433433 expect ( rows [ 0 ] ) . toEqual ( [ '1' ] )
434434 expect ( rows [ 1 ] ) . toEqual ( [ '2' ] )
435435 } )
436+
437+ it . concurrent ( 'maps JSON_OBJECT rows from inline results' , async ( ) => {
438+ const bigIntValue = 9007199254740993n
439+ const result = await executeStatement (
440+ `SELECT
441+ 42 AS num,
442+ 'hello' AS str,
443+ CAST(9007199254740993 AS BIGINT) AS big_int,
444+ CAST(12.34 AS DECIMAL(10, 2)) AS price,
445+ DATE '2024-01-02' AS d,
446+ TIMESTAMP '2024-01-02 03:04:05.123' AS dt,
447+ named_struct(
448+ 'a',
449+ 1,
450+ 'b',
451+ named_struct('c', 'x')
452+ ) AS nested` ,
453+ auth ,
454+ { disposition : 'INLINE' , format : 'JSON_ARRAY' }
455+ )
456+
457+ expect ( result . status . state ) . toBe ( 'SUCCEEDED' )
458+
459+ const rows = await fetchAll ( result , auth , { format : 'JSON_OBJECT' } )
460+ expect ( rows ) . toEqual ( [
461+ {
462+ num : 42 ,
463+ str : 'hello' ,
464+ big_int : bigIntValue ,
465+ price : 12.34 ,
466+ d : '2024-01-02' ,
467+ dt : '2024-01-02T03:04:05.123Z' ,
468+ nested : {
469+ a : 1 ,
470+ b : {
471+ c : 'x' ,
472+ } ,
473+ } ,
474+ } ,
475+ ] )
476+ } )
477+
478+ it . concurrent ( 'maps ARRAY columns with nested STRUCTs from inline results' , async ( ) => {
479+ const bigIntValue = 9007199254740993n
480+ const result = await executeStatement (
481+ `SELECT
482+ array(1, 2, 3) AS int_array,
483+ array('a', 'b') AS string_array,
484+ array(
485+ named_struct(
486+ 'id',
487+ CAST(9007199254740993 AS BIGINT),
488+ 'label',
489+ 'alpha',
490+ 'created_at',
491+ TIMESTAMP '2024-01-02 03:04:05.123',
492+ 'scores',
493+ array(1, 2, 3),
494+ 'meta',
495+ named_struct('flag', true, 'note', 'ok')
496+ ),
497+ named_struct(
498+ 'id',
499+ CAST(2 AS BIGINT),
500+ 'label',
501+ 'beta',
502+ 'created_at',
503+ TIMESTAMP '2024-02-03 04:05:06.789',
504+ 'scores',
505+ array(4, 5),
506+ 'meta',
507+ named_struct('flag', false, 'note', 'ng')
508+ )
509+ ) AS struct_array` ,
510+ auth ,
511+ { disposition : 'INLINE' , format : 'JSON_ARRAY' }
512+ )
513+
514+ expect ( result . status . state ) . toBe ( 'SUCCEEDED' )
515+
516+ const rows = await fetchAll ( result , auth , { format : 'JSON_OBJECT' } )
517+ expect ( rows ) . toEqual ( [
518+ {
519+ int_array : [ 1 , 2 , 3 ] ,
520+ string_array : [ 'a' , 'b' ] ,
521+ struct_array : [
522+ {
523+ id : bigIntValue ,
524+ label : 'alpha' ,
525+ created_at : '2024-01-02T03:04:05.123Z' ,
526+ scores : [ 1 , 2 , 3 ] ,
527+ meta : {
528+ flag : true ,
529+ note : 'ok' ,
530+ } ,
531+ } ,
532+ {
533+ id : 2n ,
534+ label : 'beta' ,
535+ created_at : '2024-02-03T04:05:06.789Z' ,
536+ scores : [ 4 , 5 ] ,
537+ meta : {
538+ flag : false ,
539+ note : 'ng' ,
540+ } ,
541+ } ,
542+ ] ,
543+ } ,
544+ ] )
545+ } )
436546 } )
437547
438548 describe . concurrent ( 'fetchAll with external links' , ( ) => {
0 commit comments