@@ -21,7 +21,7 @@ use datafusion_common::config_namespace;
2121use datafusion_common:: internal_datafusion_err;
2222use datafusion_common:: not_impl_err;
2323use datafusion_common:: parsers:: CompressionTypeVariant ;
24- use datafusion_common:: stats:: Precision ;
24+ use datafusion_common:: stats:: Precision as DFPrecision ;
2525use datafusion_common_runtime:: SpawnedTask ;
2626use datafusion_datasource:: TableSchema ;
2727use datafusion_datasource:: file:: FileSource ;
@@ -52,7 +52,7 @@ use vortex::dtype::PType;
5252use vortex:: error:: VortexExpect ;
5353use vortex:: error:: VortexResult ;
5454use vortex:: error:: vortex_err;
55- use vortex:: expr:: stats;
55+ use vortex:: expr:: stats:: Precision ;
5656use vortex:: expr:: stats:: Stat ;
5757use vortex:: file:: EOF_SIZE ;
5858use vortex:: file:: MAX_POSTSCRIPT_SIZE ;
@@ -499,12 +499,12 @@ impl FileFormat for VortexFormat {
499499 let Some ( file_stats) = file_stats else {
500500 // If the file has no column stats, the best we can do is return a row count.
501501 return Ok ( Statistics {
502- num_rows : Precision :: Exact (
502+ num_rows : DFPrecision :: Exact (
503503 usize:: try_from ( row_count)
504504 . map_err ( |_| vortex_err ! ( "Row count overflow" ) )
505505 . vortex_expect ( "Row count overflow" ) ,
506506 ) ,
507- total_byte_size : Precision :: Absent ,
507+ total_byte_size : DFPrecision :: Absent ,
508508 column_statistics : vec ! [
509509 ColumnStatistics :: default ( ) ;
510510 table_schema. fields( ) . len( )
@@ -544,6 +544,7 @@ impl FileFormat for VortexFormat {
544544 stats_dtype,
545545 & target_dtype,
546546 ) ;
547+
547548 let max = scalar_stat_to_df (
548549 Stat :: Max ,
549550 stats_set. get ( Stat :: Max ) ,
@@ -557,7 +558,7 @@ impl FileFormat for VortexFormat {
557558 null_count : null_count. to_df ( ) ,
558559 min_value : min. to_df ( ) ,
559560 max_value : max. to_df ( ) ,
560- sum_value : Precision :: Absent ,
561+ sum_value : DFPrecision :: Absent ,
561562 distinct_count : is_constant_to_distinct_count (
562563 stats_set. get_as :: < bool > (
563564 Stat :: IsConstant ,
@@ -570,10 +571,10 @@ impl FileFormat for VortexFormat {
570571
571572 let total_byte_size = column_statistics
572573 . iter ( )
573- . fold ( Precision :: Exact ( 0 ) , |acc, cs| acc. add ( & cs. byte_size ) ) ;
574+ . fold ( DFPrecision :: Exact ( 0 ) , |acc, cs| acc. add ( & cs. byte_size ) ) ;
574575
575576 Ok ( Statistics {
576- num_rows : Precision :: Exact (
577+ num_rows : DFPrecision :: Exact (
577578 usize:: try_from ( row_count)
578579 . map_err ( |_| vortex_err ! ( "Row count overflow" ) )
579580 . vortex_expect ( "Row count overflow" ) ,
@@ -639,11 +640,13 @@ impl FileFormat for VortexFormat {
639640
640641fn scalar_stat_to_df (
641642 stat : Stat ,
642- value : stats :: Precision < VortexScalarValue > ,
643+ value : Precision < VortexScalarValue > ,
643644 stats_dtype : & DType ,
644645 target_dtype : & DType ,
645- ) -> Option < stats:: Precision < DFScalarValue > > {
646- let stat_dtype = stat. dtype ( stats_dtype) ?;
646+ ) -> Precision < DFScalarValue > {
647+ let Some ( stat_dtype) = stat. dtype ( stats_dtype) else {
648+ return Precision :: Absent ;
649+ } ;
647650
648651 value
649652 . map ( |stat_value| {
@@ -652,7 +655,7 @@ fn scalar_stat_to_df(
652655 . try_to_df ( )
653656 } )
654657 . transpose ( )
655- . ok ( )
658+ . unwrap_or ( Precision :: Absent )
656659}
657660
658661#[ cfg( test) ]
0 commit comments