Skip to content

Commit 7aa00b7

Browse files
Merge branch 'main' into vp/security-bump-runtime-and-dev
Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
2 parents 3318065 + 890f6ac commit 7aa00b7

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

lib/result/CloudFetchResultHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export default class CloudFetchResultHandler implements IResultsProvider<ArrowBa
103103

104104
this.context
105105
.getLogger()
106-
.log(LogLevel.info, `Result File Download speed from cloud storage ${cleanUrl}: ${speedMBps.toFixed(4)} MB/s`);
106+
.log(LogLevel.debug, `Result File Download speed from cloud storage ${cleanUrl}: ${speedMBps.toFixed(4)} MB/s`);
107107

108108
const speedThresholdMBps = this.context.getConfig().cloudFetchSpeedThresholdMBps;
109109
if (speedMBps < speedThresholdMBps) {

tests/unit/result/CloudFetchResultHandler.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { compressFrameSync } from 'lz4-napi';
55
import { Request, Response } from 'node-fetch';
66
import { ShouldRetryResult } from '../../../lib/connection/contracts/IRetryPolicy';
77
import { HttpTransactionDetails } from '../../../lib/connection/contracts/IConnectionProvider';
8+
import { LogLevel } from '../../../lib/contracts/IDBSQLLogger';
89
import CloudFetchResultHandler from '../../../lib/result/CloudFetchResultHandler';
910
import ResultsProviderStub from '../.stubs/ResultsProviderStub';
1011
import { TRowSet, TSparkArrowResultLink, TStatusCode } from '../../../thrift/TCLIService_types';
@@ -199,6 +200,26 @@ describe('CloudFetchResultHandler', () => {
199200
expect(context.invokeWithRetryStub.called).to.be.false;
200201
});
201202

203+
it('should log cloud fetch download speed at debug level', async () => {
204+
const context = new ClientContextStub({ cloudFetchConcurrentDownloads: 1 });
205+
const rowSetProvider = new ResultsProviderStub([sampleRowSet1], undefined);
206+
const result = new CloudFetchResultHandler(context, rowSetProvider, {
207+
status: { statusCode: TStatusCode.SUCCESS_STATUS },
208+
});
209+
210+
const logStub = sinon.stub(context.logger, 'log');
211+
context.invokeWithRetryStub.callsFake(async () => ({
212+
request: new Request('localhost'),
213+
response: new Response(Buffer.concat([sampleArrowSchema, sampleArrowBatch]), { status: 200 }),
214+
}));
215+
216+
await result.fetchNext({ limit: 10000 });
217+
218+
expect(logStub.calledWith(LogLevel.debug, sinon.match(/Result File Download speed from cloud storage/))).to.be.true;
219+
expect(logStub.neverCalledWith(LogLevel.info, sinon.match(/Result File Download speed from cloud storage/))).to.be
220+
.true;
221+
});
222+
202223
it('should download batches according to settings', async () => {
203224
const context = new ClientContextStub({ cloudFetchConcurrentDownloads: 3 });
204225
const clientConfig = context.getConfig();

0 commit comments

Comments
 (0)