@@ -16,13 +16,10 @@ use vortex_bench::Format;
1616use vortex_bench:: IdempotentPath ;
1717use vortex_bench:: generate_duckdb_registration_sql;
1818use vortex_bench:: runner:: BenchmarkQueryResult ;
19- use vortex_bench:: validation;
2019use vortex_duckdb:: duckdb:: Config ;
2120use vortex_duckdb:: duckdb:: Connection ;
2221use vortex_duckdb:: duckdb:: Database ;
23- use vortex_duckdb:: duckdb:: ExtractedValue ;
2422use vortex_duckdb:: duckdb:: QueryResult ;
25- use vortex_duckdb:: duckdb:: Value ;
2623
2724/// DuckDB context for benchmarks.
2825pub struct DuckClient {
@@ -209,7 +206,7 @@ impl DuckClient {
209206/// Eagerly materialized wrapper around DuckDB query results.
210207///
211208/// Materializes the result on construction so that both `row_count()`,
212- /// `display()`, and `normalized_result ()` can be called via shared reference.
209+ /// `display()`, and `result_rows ()` can be called via shared reference.
213210pub struct DuckQueryResult {
214211 row_count : usize ,
215212 display_string : String ,
@@ -246,7 +243,7 @@ impl DuckQueryResult {
246243 for col_idx in 0 ..chunk. column_count ( ) {
247244 let vector = chunk. get_vector ( col_idx) ;
248245 let cell = match vector. get_value ( row_idx, chunk. len ( ) ) {
249- Some ( value) => normalize_duckdb_value ( & value) ,
246+ Some ( value) => value. to_string ( ) ,
250247 None => "NULL" . to_string ( ) ,
251248 } ;
252249 row. push ( cell) ;
@@ -273,43 +270,7 @@ impl BenchmarkQueryResult for DuckQueryResult {
273270 self . display_string
274271 }
275272
276- fn normalized_result ( & self ) -> ( Vec < String > , Vec < Vec < String > > ) {
273+ fn result_rows ( & self ) -> ( Vec < String > , Vec < Vec < String > > ) {
277274 ( self . column_names . clone ( ) , self . normalized_rows . clone ( ) )
278275 }
279276}
280-
281- /// Normalize a DuckDB value to a canonical string representation.
282- ///
283- /// Uses the same normalization as `vortex-sqllogictest`'s `ValueDisplayAdapter`
284- /// and the shared [`vortex_bench::validation`] helpers so that results are
285- /// comparable with DataFusion output.
286- fn normalize_duckdb_value ( value : & Value ) -> String {
287- match value. extract ( ) {
288- ExtractedValue :: Null => "NULL" . to_string ( ) ,
289- ExtractedValue :: TinyInt ( v) => v. to_string ( ) ,
290- ExtractedValue :: SmallInt ( v) => v. to_string ( ) ,
291- ExtractedValue :: Integer ( v) => v. to_string ( ) ,
292- ExtractedValue :: BigInt ( v) => v. to_string ( ) ,
293- ExtractedValue :: HugeInt ( v) => v. to_string ( ) ,
294- ExtractedValue :: UTinyInt ( v) => v. to_string ( ) ,
295- ExtractedValue :: USmallInt ( v) => v. to_string ( ) ,
296- ExtractedValue :: UInteger ( v) => v. to_string ( ) ,
297- ExtractedValue :: UBigInt ( v) => v. to_string ( ) ,
298- ExtractedValue :: UHugeInt ( v) => v. to_string ( ) ,
299- ExtractedValue :: Float ( v) => validation:: normalize_f32 ( v) ,
300- ExtractedValue :: Double ( v) => validation:: normalize_f64 ( v) ,
301- ExtractedValue :: Boolean ( v) => v. to_string ( ) ,
302- ExtractedValue :: Varchar ( s) => validation:: normalize_string ( s. as_str ( ) ) ,
303- ExtractedValue :: Decimal ( _, scale, v) => validation:: normalize_decimal ( v, scale) ,
304- // Normalize timestamps to a canonical format for cross-engine comparison.
305- ExtractedValue :: Date ( _)
306- | ExtractedValue :: TimestampNs ( _)
307- | ExtractedValue :: Timestamp ( _)
308- | ExtractedValue :: TimestampMs ( _)
309- | ExtractedValue :: TimestampS ( _) => validation:: normalize_timestamp ( & value. to_string ( ) ) ,
310- // Delegate to DuckDB's native string representation for other types.
311- ExtractedValue :: Blob ( _) | ExtractedValue :: Time ( _) | ExtractedValue :: List ( _) => {
312- value. to_string ( )
313- }
314- }
315- }
0 commit comments