Skip to content

Commit 0c12c75

Browse files
committed
update: test
1 parent bda5135 commit 0c12c75

File tree

6 files changed

+20
-71
lines changed

6 files changed

+20
-71
lines changed

benchmarking/benchmarking-app/src/app/app.tsx

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { Route, BrowserRouter as Router, Routes } from 'react-router-dom';
2-
import { JSON_TEST_QUERIES } from './constants';
32
import { IndexedDBMProvider } from './dbm-context/indexed-dbm-context';
43
import { MemoryDBMProvider } from './dbm-context/memory-dbm-context';
54
import { RawDBMProvider } from './dbm-context/raw-dbm-context';
65
import { FileLoader } from './file-loader/file-loader';
7-
import { JsonLoader } from './file-loader/json-loader';
86
import { QueryBenchmarking } from './query-benchmarking/query-benchmarking';
97

108
export function App() {
@@ -51,19 +49,6 @@ export function App() {
5149
</div>
5250
}
5351
/>
54-
<Route
55-
path="/register-json"
56-
element={
57-
<div>
58-
<h1>Register JSON with Memory DBM</h1>
59-
<MemoryDBMProvider>
60-
<JsonLoader>
61-
<QueryBenchmarking testQueries={JSON_TEST_QUERIES} />
62-
</JsonLoader>
63-
</MemoryDBMProvider>
64-
</div>
65-
}
66-
/>
6752
</Routes>
6853
</Router>
6954
);

benchmarking/benchmarking-app/src/app/benchmarking-tests/dbm-benchmarking.spec.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import axios from 'axios';
2-
import { ChildProcess, spawn } from 'child_process';
2+
import { spawn } from 'child_process';
33
import * as puppeteer from 'puppeteer';
44

55
describe('Benchmarking DBMs', () => {
6-
let page;
7-
let browser;
8-
let appProcess;
6+
let page;
7+
let browser;
8+
let appProcess;
99

1010
let totalTimeForMemoryDB: number;
1111

@@ -93,15 +93,6 @@ describe('Benchmarking DBMs', () => {
9393
expect(totalTimeForIndexedDBM).toBeLessThan(totalTimeForMemoryDB * 1.3);
9494
}, 300000);
9595

96-
it('Benchmark registering json data', async () => {
97-
await page.goto('http://localhost:4200/register-json');
98-
99-
/**
100-
* wait for total time to be rendered
101-
*/
102-
await page.waitForSelector('#total_time', { timeout: 100000 });
103-
}, 300000);
104-
10596
afterAll(async () => {
10697
await browser.close();
10798
appProcess.kill('SIGTERM');

benchmarking/benchmarking-app/src/app/constants.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const FILE_TEST_QUERIES = [
1+
export const TEST_QUERIES = [
22
'SELECT CAST(COUNT(*) as VARCHAR) as total_count FROM taxi.parquet',
33
"SELECT * FROM taxi.parquet WHERE originating_base_num='B03404' LIMIT 100",
44
'SELECT CAST(COUNT(*) as VARCHAR) as total_count FROM taxi.parquet GROUP BY hvfhs_license_num',
@@ -31,11 +31,8 @@ export const FILE_TEST_QUERIES = [
3131
group_by_query.hvfhs_license_num = full_query.hvfhs_license_num
3232
LIMIT 1
3333
`,
34-
];
35-
36-
export const JSON_TEST_QUERIES = [
37-
'SELECT CAST(COUNT(*) as VARCHAR) as total_count FROM taxi',
38-
'SELECT * FROM taxi WHERE price >= 1.0005812645 LIMIT 100',
39-
'SELECT CAST(COUNT(*) as VARCHAR) as total_count FROM taxi GROUP BY order_count',
40-
'SELECT * as total_count FROM taxi ORDER BY seconds_in_bucket LIMIT 100',
34+
'SELECT CAST(COUNT(*) as VARCHAR) as total_count FROM taxijson',
35+
'SELECT * FROM taxijson WHERE price >= 1.0005812645 LIMIT 100',
36+
'SELECT CAST(COUNT(*) as VARCHAR) as total_count FROM taxijson GROUP BY order_count',
37+
'SELECT * as total_count FROM taxijson ORDER BY seconds_in_bucket LIMIT 100',
4138
];

benchmarking/benchmarking-app/src/app/file-loader/file-loader.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import axios from 'axios';
22
import { useState } from 'react';
3+
import TAXI_JSON_DATA from '../../assets/data-sets/taxi.json';
34
import { useDBM } from '../hooks/dbm-context';
45
import { useClassicEffect } from '../hooks/use-classic-effect';
56

@@ -21,6 +22,12 @@ export const FileLoader = ({ children }: { children: JSX.Element }) => {
2122
buffer: fileBufferView,
2223
});
2324

25+
await fileManager.registerJSON({
26+
json: TAXI_JSON_DATA,
27+
tableName: 'taxijson',
28+
fileName: 'taxi.json',
29+
});
30+
2431
setIsFileLoader(true);
2532
})();
2633
}, []);

benchmarking/benchmarking-app/src/app/file-loader/json-loader.tsx

Lines changed: 0 additions & 27 deletions
This file was deleted.

benchmarking/benchmarking-app/src/app/query-benchmarking/query-benchmarking.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
import { useState } from 'react';
2-
import { FILE_TEST_QUERIES } from '../constants';
2+
import { TEST_QUERIES } from '../constants';
33
import { useDBM } from '../hooks/dbm-context';
44
import { useClassicEffect } from '../hooks/use-classic-effect';
55

6-
export const QueryBenchmarking = ({
7-
testQueries = FILE_TEST_QUERIES,
8-
}: {
9-
testQueries?: string[];
10-
}) => {
6+
export const QueryBenchmarking = () => {
117
const [output, setOutput] = useState<
128
{
139
queryName: string;
@@ -23,11 +19,11 @@ export const QueryBenchmarking = ({
2319
setOutput([]);
2420
const promiseArr = [];
2521
const start = performance.now();
26-
for (let i = 0; i < testQueries.length; i++) {
22+
for (let i = 0; i < TEST_QUERIES.length; i++) {
2723
const eachQueryStart = performance.now();
2824

2925
const promiseObj = dbm
30-
.queryWithTableNames(testQueries[i], ['taxi'])
26+
.queryWithTableNames(TEST_QUERIES[i], ['taxi'])
3127
.then((results) => {
3228
const end = performance.now();
3329
const time = end - eachQueryStart;

0 commit comments

Comments
 (0)