@@ -20,15 +20,21 @@ import getResult from './getResult';
2020
2121export default class DBSQLOperation implements IOperation {
2222 private driver : HiveDriver ;
23+
2324 private operationHandle : TOperationHandle ;
25+
2426 private schema : TTableSchema | null = null ;
27+
2528 private data : Array < TRowSet > = [ ] ;
29+
2630 private statusFactory = new StatusFactory ( ) ;
2731
2832 private fetchType : number = 0 ;
2933
3034 private _hasMoreRows : boolean = false ;
35+
3136 private state : number = TOperationState . INITIALIZED_STATE ;
37+
3238 private hasResultSet : boolean = false ;
3339
3440 constructor ( driver : HiveDriver , operationHandle : TOperationHandle ) {
@@ -65,15 +71,14 @@ export default class DBSQLOperation implements IOperation {
6571 return this . firstFetch ( chunkSize ) ;
6672 } )
6773 . then ( ( response ) => this . processFetchResponse ( response ) ) ;
68- } else {
69- return this . nextFetch ( chunkSize ) . then ( ( response ) => this . processFetchResponse ( response ) ) ;
7074 }
75+ return this . nextFetch ( chunkSize ) . then ( ( response ) => this . processFetchResponse ( response ) ) ;
7176 }
7277
7378 async fetchAll ( options ?: IFetchOptions ) : Promise < Array < object > > {
74- let data : Array < object > = [ ] ;
79+ const data : Array < object > = [ ] ;
7580 do {
76- let chunk = await this . fetchChunk ( options ) ;
81+ const chunk = await this . fetchChunk ( options ) ; // eslint-disable-line no-await-in-loop
7782 if ( chunk ) {
7883 data . push ( ...chunk ) ;
7984 }
@@ -88,8 +93,8 @@ export default class DBSQLOperation implements IOperation {
8893
8994 await waitUntilReady ( this , options . progress , options . callback ) ;
9095
91- return await this . fetch ( options . maxRows ) . then ( ( ) => {
92- let data = getResult ( this . getSchema ( ) , this . getData ( ) ) ;
96+ return this . fetch ( options . maxRows ) . then ( ( ) => {
97+ const data = getResult ( this . getSchema ( ) , this . getData ( ) ) ;
9398 this . flush ( ) ;
9499 return Promise . resolve ( data ) ;
95100 } ) ;
@@ -128,9 +133,7 @@ export default class DBSQLOperation implements IOperation {
128133 . cancelOperation ( {
129134 operationHandle : this . operationHandle ,
130135 } )
131- . then ( ( response ) => {
132- return this . statusFactory . create ( response . status ) ;
133- } ) ;
136+ . then ( ( response ) => this . statusFactory . create ( response . status ) ) ;
134137 }
135138
136139 /**
@@ -142,9 +145,7 @@ export default class DBSQLOperation implements IOperation {
142145 . closeOperation ( {
143146 operationHandle : this . operationHandle ,
144147 } )
145- . then ( ( response ) => {
146- return this . statusFactory . create ( response . status ) ;
147- } ) ;
148+ . then ( ( response ) => this . statusFactory . create ( response . status ) ) ;
148149 }
149150
150151 finished ( ) : boolean {
0 commit comments