diff --git a/lib/DBSQLOperation/FetchResultsHelper.ts b/lib/DBSQLOperation/FetchResultsHelper.ts index fd2ec1f9..2275e105 100644 --- a/lib/DBSQLOperation/FetchResultsHelper.ts +++ b/lib/DBSQLOperation/FetchResultsHelper.ts @@ -119,6 +119,8 @@ export default class FetchResultsHelper { this.pendingResults.push(responseFragment); } + } else { + this.pendingResults.push(response); } } } diff --git a/tests/e2e/arrow.test.js b/tests/e2e/arrow.test.js index f030bf2f..5ded6660 100644 --- a/tests/e2e/arrow.test.js +++ b/tests/e2e/arrow.test.js @@ -137,7 +137,7 @@ describe('Arrow support', () => { // but with much enough rows there should be more than one result batch expect(rawData.arrowBatches?.length).to.be.gt(1); - const result = resultHandler.getValue([rawData]); + const result = await resultHandler.getValue([rawData]); expect(result.length).to.be.eq(rowsCount); }); }); diff --git a/tests/unit/result/ArrowResult.test.js b/tests/unit/result/ArrowResult.test.js index 69182ac6..0c72fc1b 100644 --- a/tests/unit/result/ArrowResult.test.js +++ b/tests/unit/result/ArrowResult.test.js @@ -67,22 +67,22 @@ const sampleRowSet4 = { }; describe('ArrowResult', () => { - it('should convert data', () => { + it('should convert data', async () => { const result = new ArrowResult(sampleThriftSchema, sampleArrowSchema); - expect(result.getValue([sampleRowSet1])).to.be.deep.eq([]); - expect(result.getValue([sampleRowSet2])).to.be.deep.eq([]); - expect(result.getValue([sampleRowSet3])).to.be.deep.eq([]); - expect(result.getValue([sampleRowSet4])).to.be.deep.eq([{ 1: 1 }]); + expect(await result.getValue([sampleRowSet1])).to.be.deep.eq([]); + expect(await result.getValue([sampleRowSet2])).to.be.deep.eq([]); + expect(await result.getValue([sampleRowSet3])).to.be.deep.eq([]); + expect(await result.getValue([sampleRowSet4])).to.be.deep.eq([{ 1: 1 }]); }); - it('should return empty array if no data to process', () => { + it('should return empty array if no data to process', async () => { const result = new ArrowResult(sampleThriftSchema, sampleArrowSchema); - expect(result.getValue()).to.be.deep.eq([]); - expect(result.getValue([])).to.be.deep.eq([]); + expect(await result.getValue()).to.be.deep.eq([]); + expect(await result.getValue([])).to.be.deep.eq([]); }); - it('should return empty array if no schema available', () => { + it('should return empty array if no schema available', async () => { const result = new ArrowResult(); - expect(result.getValue([sampleRowSet4])).to.be.deep.eq([]); + expect(await result.getValue([sampleRowSet4])).to.be.deep.eq([]); }); }); diff --git a/tests/unit/result/JsonResult.test.js b/tests/unit/result/JsonResult.test.js index 402d5fed..fac180af 100644 --- a/tests/unit/result/JsonResult.test.js +++ b/tests/unit/result/JsonResult.test.js @@ -28,7 +28,7 @@ const getColumnSchema = (columnName, type, position) => { }; describe('JsonResult', () => { - it('should convert schema with primitive types to json', () => { + it('should convert schema with primitive types to json', async () => { const schema = { columns: [ getColumnSchema('table.str', TCLIService_types.TTypeId.STRING_TYPE, 1), @@ -111,7 +111,7 @@ describe('JsonResult', () => { const result = new JsonResult(schema); - expect(result.getValue(data)).to.be.deep.eq([ + expect(await result.getValue(data)).to.be.deep.eq([ { 'table.str': 'a', 'table.int64': 282578800148737, @@ -151,7 +151,7 @@ describe('JsonResult', () => { ]); }); - it('should convert complex types', () => { + it('should convert complex types', async () => { const schema = { columns: [ getColumnSchema('table.array', TCLIService_types.TTypeId.ARRAY_TYPE, 1), @@ -181,7 +181,7 @@ describe('JsonResult', () => { const result = new JsonResult(schema); - expect(result.getValue(data)).to.be.deep.eq([ + expect(await result.getValue(data)).to.be.deep.eq([ { 'table.array': ['a', 'b'], 'table.map': { key: 12 }, @@ -197,7 +197,7 @@ describe('JsonResult', () => { ]); }); - it('should merge data items', () => { + it('should merge data items', async () => { const schema = { columns: [getColumnSchema('table.id', TCLIService_types.TTypeId.STRING_TYPE, 1)], }; @@ -221,7 +221,7 @@ describe('JsonResult', () => { const result = new JsonResult(schema); - expect(result.getValue(data)).to.be.deep.eq([ + expect(await result.getValue(data)).to.be.deep.eq([ { 'table.id': '0' }, { 'table.id': '1' }, { 'table.id': '2' }, @@ -263,7 +263,7 @@ describe('JsonResult', () => { }); }); - it('should detect nulls for each type', () => { + it('should detect nulls for each type', async () => { const schema = { columns: [ getColumnSchema('table.str', TCLIService_types.TTypeId.STRING_TYPE, 1), @@ -344,7 +344,7 @@ describe('JsonResult', () => { const result = new JsonResult(schema); - expect(result.getValue(data)).to.be.deep.eq([ + expect(await result.getValue(data)).to.be.deep.eq([ { 'table.str': null, 'table.int64': null, @@ -366,18 +366,18 @@ describe('JsonResult', () => { ]); }); - it('should return empty array if no data to process', () => { + it('should return empty array if no data to process', async () => { const schema = { columns: [getColumnSchema('table.id', TCLIService_types.TTypeId.STRING_TYPE, 1)], }; const result = new JsonResult(schema); - expect(result.getValue()).to.be.deep.eq([]); - expect(result.getValue([])).to.be.deep.eq([]); + expect(await result.getValue()).to.be.deep.eq([]); + expect(await result.getValue([])).to.be.deep.eq([]); }); - it('should return empty array if no schema available', () => { + it('should return empty array if no schema available', async () => { const data = [ { columns: [ @@ -390,10 +390,10 @@ describe('JsonResult', () => { const result = new JsonResult(); - expect(result.getValue(data)).to.be.deep.eq([]); + expect(await result.getValue(data)).to.be.deep.eq([]); }); - it('should return raw data if types are not specified', () => { + it('should return raw data if types are not specified', async () => { const schema = { columns: [ getColumnSchema('table.array', undefined, 1), @@ -423,7 +423,7 @@ describe('JsonResult', () => { const result = new JsonResult(schema); - expect(result.getValue(data)).to.be.deep.eq([ + expect(await result.getValue(data)).to.be.deep.eq([ { 'table.array': '["a", "b"]', 'table.map': '{ "key": 12 }', diff --git a/tests/unit/result/compatibility.test.js b/tests/unit/result/compatibility.test.js index 0588e42f..8df3e6a8 100644 --- a/tests/unit/result/compatibility.test.js +++ b/tests/unit/result/compatibility.test.js @@ -8,21 +8,21 @@ const fixtureArrow = require('../../fixtures/compatibility/arrow'); const fixtureArrowNT = require('../../fixtures/compatibility/arrow_native_types'); describe('Result handlers compatibility tests', () => { - it('colum-based data', () => { + it('colum-based data', async () => { const result = new JsonResult(fixtureColumn.schema); - const rows = result.getValue(fixtureColumn.rowSets); + const rows = await result.getValue(fixtureColumn.rowSets); expect(rows).to.deep.equal(fixtureColumn.expected); }); - it('arrow-based data without native types', () => { + it('arrow-based data without native types', async () => { const result = new ArrowResult(fixtureArrow.schema, fixtureArrow.arrowSchema); - const rows = result.getValue(fixtureArrow.rowSets); + const rows = await result.getValue(fixtureArrow.rowSets); expect(fixArrowResult(rows)).to.deep.equal(fixtureArrow.expected); }); - it('arrow-based data with native types', () => { + it('arrow-based data with native types', async () => { const result = new ArrowResult(fixtureArrowNT.schema, fixtureArrowNT.arrowSchema); - const rows = result.getValue(fixtureArrowNT.rowSets); + const rows = await result.getValue(fixtureArrowNT.rowSets); expect(fixArrowResult(rows)).to.deep.equal(fixtureArrowNT.expected); }); });