File tree Expand file tree Collapse file tree 2 files changed +41
-2
lines changed Expand file tree Collapse file tree 2 files changed +41
-2
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ function cleanUpPaginatedDML(
8888 if ( ! Data ) return acc ;
8989
9090 const rowObject = Data ?. reduce ( ( acc , row , index ) => {
91- if ( row . VarCharValue ) {
91+ if ( row . VarCharValue !== undefined && row . VarCharValue !== null ) {
9292 // use mutable operation for performance
9393 acc [ columnNames [ index ] ] = row . VarCharValue ;
9494 }
@@ -113,7 +113,7 @@ function addDataType(
113113 > = { } ;
114114
115115 for ( const key in input ) {
116- if ( ! input [ key ] ) {
116+ if ( input [ key ] === null || input [ key ] === undefined ) {
117117 updatedObjectWithDataType [ key ] = null ;
118118 } else {
119119 switch ( dataTypes [ key ] ) {
Original file line number Diff line number Diff line change @@ -321,3 +321,42 @@ test("throw exception when query is respond as failed", async () => {
321321 "No QueryExecutionId was responded."
322322 ) ;
323323} ) ;
324+
325+ test ( "If empty string is returned from AthenaSDK, it will be returned as an empty string" , async ( ) => {
326+ athenaMock
327+ . on ( StartQueryExecutionCommand )
328+ . resolves ( { QueryExecutionId : "test-QueryExecutionId" } )
329+ . on ( GetQueryExecutionCommand )
330+ . resolves ( { QueryExecution : { Status : { State : "SUCCEEDED" } } } )
331+ . on ( GetQueryResultsCommand )
332+ . resolves ( {
333+ ResultSet : {
334+ ResultSetMetadata : {
335+ ColumnInfo : [
336+ { Name : "nullValue" , Type : "unknown" } ,
337+ { Name : "emptyValue" , Type : "varchar" } ,
338+ ] ,
339+ } ,
340+ Rows : [
341+ {
342+ // header row
343+ Data : [
344+ { VarCharValue : "nullValue" } ,
345+ { VarCharValue : "emptyValue" } ,
346+ ] ,
347+ } ,
348+ {
349+ Data : [ { } , { VarCharValue : "" } ] ,
350+ } ,
351+ ] ,
352+ } ,
353+ } ) ;
354+
355+ const athenaQuery = new AthenaQuery ( athena ) ;
356+ const resultGen = athenaQuery . query ( "" ) ;
357+ const res1 = await resultGen . next ( ) ;
358+ expect ( res1 . value ) . toEqual ( {
359+ // nullValue is removed from the object
360+ emptyValue : "" ,
361+ } ) ;
362+ } ) ;
You can’t perform that action at this time.
0 commit comments