File tree Expand file tree Collapse file tree 2 files changed +21
-12
lines changed
Expand file tree Collapse file tree 2 files changed +21
-12
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,17 @@ class DataFusionRunner implements BenchmarkRunner {
5656 }
5757
5858 async executeQuery ( sql : string ) : Promise < { rowCount : number } > {
59- const response = await this . query ( sql ) ;
59+ let response
60+ if ( sql . includes ( "create view" ) ) {
61+ // This is query 15
62+ let [ createView , query , dropView ] = sql . split ( ";" )
63+ await this . query ( createView ) ;
64+ response = await this . query ( query )
65+ await this . query ( dropView ) ;
66+ } else {
67+ response = await this . query ( sql )
68+ }
69+
6070 return { rowCount : response . count } ;
6171 }
6272
Original file line number Diff line number Diff line change @@ -50,19 +50,18 @@ class TrinoRunner implements BenchmarkRunner {
5050 'create view revenue0 as select l_suppkey as supplier_no, sum(l_extendedprice * (1 - l_discount)) as total_revenue'
5151 ) ;
5252
53- // Handle multi-statement queries (e.g., query 15 with CREATE VIEW)
54- const statements = sql . split ( ';' ) . map ( s => s . trim ( ) ) . filter ( s => s . length > 0 ) ;
55-
56- if ( statements . length > 1 ) {
57- // Execute all statements except the last one
58- for ( let i = 0 ; i < statements . length - 1 ; i ++ ) {
59- await this . executeSingleStatement ( statements [ i ] ) ;
60- }
61- // Execute the last statement and return its result
62- return await this . executeSingleStatement ( statements [ statements . length - 1 ] ) ;
53+ let response
54+ if ( sql . includes ( "create view" ) ) {
55+ // This is query 15
56+ let [ createView , query , dropView ] = sql . split ( ";" )
57+ await this . executeSingleStatement ( createView ) ;
58+ response = await this . executeSingleStatement ( query ) ;
59+ await this . executeSingleStatement ( dropView ) ;
60+ } else {
61+ response = await this . executeSingleStatement ( sql )
6362 }
6463
65- return await this . executeSingleStatement ( sql ) ;
64+ return response
6665 }
6766
6867 private async executeSingleStatement ( sql : string ) : Promise < { rowCount : number } > {
You can’t perform that action at this time.
0 commit comments