File tree Expand file tree Collapse file tree 6 files changed +20
-71
lines changed
benchmarking/benchmarking-app/src/app Expand file tree Collapse file tree 6 files changed +20
-71
lines changed Original file line number Diff line number Diff line change 1
1
import { Route , BrowserRouter as Router , Routes } from 'react-router-dom' ;
2
- import { JSON_TEST_QUERIES } from './constants' ;
3
2
import { IndexedDBMProvider } from './dbm-context/indexed-dbm-context' ;
4
3
import { MemoryDBMProvider } from './dbm-context/memory-dbm-context' ;
5
4
import { RawDBMProvider } from './dbm-context/raw-dbm-context' ;
6
5
import { FileLoader } from './file-loader/file-loader' ;
7
- import { JsonLoader } from './file-loader/json-loader' ;
8
6
import { QueryBenchmarking } from './query-benchmarking/query-benchmarking' ;
9
7
10
8
export function App ( ) {
@@ -51,19 +49,6 @@ export function App() {
51
49
</ div >
52
50
}
53
51
/>
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
- />
67
52
</ Routes >
68
53
</ Router >
69
54
) ;
Original file line number Diff line number Diff line change 1
1
import axios from 'axios' ;
2
- import { ChildProcess , spawn } from 'child_process' ;
2
+ import { spawn } from 'child_process' ;
3
3
import * as puppeteer from 'puppeteer' ;
4
4
5
5
describe ( 'Benchmarking DBMs' , ( ) => {
6
- let page ;
7
- let browser ;
8
- let appProcess ;
6
+ let page ;
7
+ let browser ;
8
+ let appProcess ;
9
9
10
10
let totalTimeForMemoryDB : number ;
11
11
@@ -93,15 +93,6 @@ describe('Benchmarking DBMs', () => {
93
93
expect ( totalTimeForIndexedDBM ) . toBeLessThan ( totalTimeForMemoryDB * 1.3 ) ;
94
94
} , 300000 ) ;
95
95
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
-
105
96
afterAll ( async ( ) => {
106
97
await browser . close ( ) ;
107
98
appProcess . kill ( 'SIGTERM' ) ;
Original file line number Diff line number Diff line change 1
- export const FILE_TEST_QUERIES = [
1
+ export const TEST_QUERIES = [
2
2
'SELECT CAST(COUNT(*) as VARCHAR) as total_count FROM taxi.parquet' ,
3
3
"SELECT * FROM taxi.parquet WHERE originating_base_num='B03404' LIMIT 100" ,
4
4
'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 = [
31
31
group_by_query.hvfhs_license_num = full_query.hvfhs_license_num
32
32
LIMIT 1
33
33
` ,
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' ,
41
38
] ;
Original file line number Diff line number Diff line change 1
1
import axios from 'axios' ;
2
2
import { useState } from 'react' ;
3
+ import TAXI_JSON_DATA from '../../assets/data-sets/taxi.json' ;
3
4
import { useDBM } from '../hooks/dbm-context' ;
4
5
import { useClassicEffect } from '../hooks/use-classic-effect' ;
5
6
@@ -21,6 +22,12 @@ export const FileLoader = ({ children }: { children: JSX.Element }) => {
21
22
buffer : fileBufferView ,
22
23
} ) ;
23
24
25
+ await fileManager . registerJSON ( {
26
+ json : TAXI_JSON_DATA ,
27
+ tableName : 'taxijson' ,
28
+ fileName : 'taxi.json' ,
29
+ } ) ;
30
+
24
31
setIsFileLoader ( true ) ;
25
32
} ) ( ) ;
26
33
} , [ ] ) ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
import { useState } from 'react' ;
2
- import { FILE_TEST_QUERIES } from '../constants' ;
2
+ import { TEST_QUERIES } from '../constants' ;
3
3
import { useDBM } from '../hooks/dbm-context' ;
4
4
import { useClassicEffect } from '../hooks/use-classic-effect' ;
5
5
6
- export const QueryBenchmarking = ( {
7
- testQueries = FILE_TEST_QUERIES ,
8
- } : {
9
- testQueries ?: string [ ] ;
10
- } ) => {
6
+ export const QueryBenchmarking = ( ) => {
11
7
const [ output , setOutput ] = useState <
12
8
{
13
9
queryName : string ;
@@ -23,11 +19,11 @@ export const QueryBenchmarking = ({
23
19
setOutput ( [ ] ) ;
24
20
const promiseArr = [ ] ;
25
21
const start = performance . now ( ) ;
26
- for ( let i = 0 ; i < testQueries . length ; i ++ ) {
22
+ for ( let i = 0 ; i < TEST_QUERIES . length ; i ++ ) {
27
23
const eachQueryStart = performance . now ( ) ;
28
24
29
25
const promiseObj = dbm
30
- . queryWithTableNames ( testQueries [ i ] , [ 'taxi' ] )
26
+ . queryWithTableNames ( TEST_QUERIES [ i ] , [ 'taxi' ] )
31
27
. then ( ( results ) => {
32
28
const end = performance . now ( ) ;
33
29
const time = end - eachQueryStart ;
You can’t perform that action at this time.
0 commit comments