Decouple `join-order.ts` from VS Code for testing purposes
This commit is contained in:
Родитель
4b875e7e42
Коммит
131e72b162
|
@ -33,6 +33,7 @@ import {
|
|||
CliConfigListener,
|
||||
DistributionConfigListener,
|
||||
isCanary,
|
||||
joinOrderWarningThreshold,
|
||||
MAX_QUERIES,
|
||||
QueryHistoryConfigListener,
|
||||
QueryServerConfigListener
|
||||
|
@ -518,7 +519,7 @@ async function activateWithInstalledDistribution(
|
|||
void logger.log('Initializing evaluation log scanners.');
|
||||
const logScannerService = new LogScannerService(qhm);
|
||||
ctx.subscriptions.push(logScannerService);
|
||||
ctx.subscriptions.push(logScannerService.scanners.registerLogScannerProvider(new JoinOrderScannerProvider()));
|
||||
ctx.subscriptions.push(logScannerService.scanners.registerLogScannerProvider(new JoinOrderScannerProvider(() => joinOrderWarningThreshold())));
|
||||
|
||||
void logger.log('Reading query history');
|
||||
await qhm.readQueryHistory();
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import * as I from 'immutable';
|
||||
import { joinOrderWarningThreshold } from '../config';
|
||||
import { EvaluationLogProblemReporter, EvaluationLogScanner, EvaluationLogScannerProvider } from './log-scanner';
|
||||
import { InLayer, ComputeRecursive, SummaryEvent, PipelineRun, ComputeSimple } from './log-summary';
|
||||
|
||||
|
@ -453,8 +452,11 @@ class JoinOrderScanner implements EvaluationLogScanner {
|
|||
}
|
||||
|
||||
export class JoinOrderScannerProvider implements EvaluationLogScannerProvider {
|
||||
constructor(private readonly getThreshdold: () => number) {
|
||||
}
|
||||
|
||||
public createScanner(problemReporter: EvaluationLogProblemReporter): EvaluationLogScanner {
|
||||
const threshold = joinOrderWarningThreshold();
|
||||
const threshold = this.getThreshdold();
|
||||
return new JoinOrderScanner(problemReporter, threshold);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class TestProblemReporter implements EvaluationLogProblemReporter {
|
|||
describe('log scanners', function() {
|
||||
it('should detect bad join orders', async function() {
|
||||
const scanners = new EvaluationLogScannerSet();
|
||||
scanners.registerLogScannerProvider(new JoinOrderScannerProvider());
|
||||
scanners.registerLogScannerProvider(new JoinOrderScannerProvider(() => 50));
|
||||
const summaryPath = path.join(__dirname, 'evaluator-log-summaries/bad-join-order.jsonl');
|
||||
const problemReporter = new TestProblemReporter();
|
||||
await scanners.scanLog(summaryPath, problemReporter);
|
||||
|
|
Загрузка…
Ссылка в новой задаче