File tree Expand file tree Collapse file tree 4 files changed +16
-6
lines changed
Expand file tree Collapse file tree 4 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -232,7 +232,7 @@ export default class DBSQLSession implements IDBSQLSession {
232232 }
233233
234234 if ( ProtocolVersion . supportsArrowCompression ( this . serverProtocolVersion ) && request . canDownloadResult !== true ) {
235- request . canDecompressLZ4Result = ( options . useLZ4Compression ?? clientConfig . useLZ4Compression ) && Boolean ( LZ4 ) ;
235+ request . canDecompressLZ4Result = ( options . useLZ4Compression ?? clientConfig . useLZ4Compression ) && Boolean ( LZ4 ( ) ) ;
236236 }
237237
238238 const operationPromise = driver . executeStatement ( request ) ;
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ export default class ArrowResultHandler implements IResultsProvider<ArrowBatch>
2626 this . arrowSchema = arrowSchema ?? hiveSchemaToArrowSchema ( schema ) ;
2727 this . isLZ4Compressed = lz4Compressed ?? false ;
2828
29- if ( this . isLZ4Compressed && ! LZ4 ) {
29+ if ( this . isLZ4Compressed && ! LZ4 ( ) ) {
3030 throw new HiveDriverError ( 'Cannot handle LZ4 compressed result: module `lz4` not installed' ) ;
3131 }
3232 }
@@ -52,7 +52,7 @@ export default class ArrowResultHandler implements IResultsProvider<ArrowBatch>
5252 let totalRowCount = 0 ;
5353 rowSet ?. arrowBatches ?. forEach ( ( { batch, rowCount } ) => {
5454 if ( batch ) {
55- batches . push ( this . isLZ4Compressed ? LZ4 ! . decode ( batch ) : batch ) ;
55+ batches . push ( this . isLZ4Compressed ? LZ4 ( ) ! . decode ( batch ) : batch ) ;
5656 totalRowCount += rowCount . toNumber ( true ) ;
5757 }
5858 } ) ;
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ export default class CloudFetchResultHandler implements IResultsProvider<ArrowBa
2727 this . source = source ;
2828 this . isLZ4Compressed = lz4Compressed ?? false ;
2929
30- if ( this . isLZ4Compressed && ! LZ4 ) {
30+ if ( this . isLZ4Compressed && ! LZ4 ( ) ) {
3131 throw new HiveDriverError ( 'Cannot handle LZ4 compressed result: module `lz4` not installed' ) ;
3232 }
3333 }
@@ -64,7 +64,7 @@ export default class CloudFetchResultHandler implements IResultsProvider<ArrowBa
6464 }
6565
6666 if ( this . isLZ4Compressed ) {
67- batch . batches = batch . batches . map ( ( buffer ) => LZ4 ! . decode ( buffer ) ) ;
67+ batch . batches = batch . batches . map ( ( buffer ) => LZ4 ( ) ! . decode ( buffer ) ) ;
6868 }
6969 return batch ;
7070 }
Original file line number Diff line number Diff line change @@ -26,4 +26,14 @@ function tryLoadLZ4Module(): LZ4Module | undefined {
2626 }
2727}
2828
29- export default tryLoadLZ4Module ( ) ;
29+ // The null is already tried resolving that failed
30+ let resolvedModule : LZ4Module | null | undefined ;
31+
32+ function getResolvedModule ( ) {
33+ if ( resolvedModule === undefined ) {
34+ resolvedModule = tryLoadLZ4Module ( ) ?? null ;
35+ }
36+ return resolvedModule ?? undefined ;
37+ }
38+
39+ export default getResolvedModule ;
You can’t perform that action at this time.
0 commit comments