@@ -48,6 +48,7 @@ use vortex::file::OpenOptionsSessionExt;
4848use vortex:: io:: InstrumentedReadAt ;
4949use vortex:: layout:: LayoutReader ;
5050use vortex:: layout:: scan:: scan_builder:: ScanBuilder ;
51+ use vortex:: layout:: scan:: scan_builder:: optimize_and_bind;
5152use vortex:: layout:: scan:: split_by:: SplitBy ;
5253use vortex:: metrics:: Label ;
5354use vortex:: metrics:: MetricsRegistry ;
@@ -302,9 +303,11 @@ impl FileOpener for VortexOpener {
302303
303304 // The schema of the stream returned from the vortex scan.
304305 // We use a reference schema for types that don't roundtrip (Dictionary, Utf8, etc.).
305- let scan_dtype = scan_projection. return_dtype ( vxf. dtype ( ) ) . map_err ( |_e| {
306- exec_datafusion_err ! ( "Couldn't get the dtype for the underlying Vortex scan" )
307- } ) ?;
306+ let scan_projection =
307+ optimize_and_bind ( scan_projection, vxf. dtype ( ) ) . map_err ( |_e| {
308+ exec_datafusion_err ! ( "Couldn't get the dtype for the underlying Vortex scan" )
309+ } ) ?;
310+ let scan_dtype = scan_projection. dtype ( ) . clone ( ) ;
308311
309312 // When projection pushdown is enabled, the scan outputs the projected columns.
310313 // When disabled, the scan outputs raw columns and the projection is applied after.
@@ -419,6 +422,10 @@ impl FileOpener for VortexOpener {
419422 make_vortex_predicate ( expr_convertor. as_ref ( ) , & pushed) . transpose ( )
420423 } )
421424 . transpose ( ) ?;
425+ let filter = filter
426+ . map ( |filter| optimize_and_bind ( filter, vxf. dtype ( ) ) )
427+ . transpose ( )
428+ . map_err ( |e| exec_datafusion_err ! ( "Couldn't bind Vortex scan filter: {e}" ) ) ?;
422429
423430 if let Some ( limit) = limit
424431 && filter. is_none ( )
0 commit comments