morristai commented on code in PR #26635:
URL: https://github.com/apache/datafusion/pull/26635#discussion_r4552410047


##########
datafusion/datasource-parquet/src/source.rs:
##########
@@ -1452,6 +1452,40 @@ mod tests {
         assert!(source.filter().is_some());
     }
 
+    #[test]
+    fn parquet_file_reader_factory_downcasts_to_concrete_type() {
+        use crate::CachedParquetFileReaderFactory;
+        use datafusion_execution::cache::cache_manager::FileMetadataCache;
+        use datafusion_execution::cache::default_cache::DefaultCache;
+        use object_store::memory::InMemory;
+
+        let store: Arc<dyn ObjectStore> = Arc::new(InMemory::new());
+        let source = ParquetSource::new(Arc::new(Schema::empty()))
+            .with_parquet_file_reader_factory(Arc::new(
+                DefaultParquetFileReaderFactory::new(Arc::clone(&store)),
+            ));
+        let factory = source.parquet_file_reader_factory().unwrap();
+        assert!(factory.is::<DefaultParquetFileReaderFactory>());
+        assert!(
+            factory
+                .downcast_ref::<CachedParquetFileReaderFactory>()
+                .is_none()
+        );
+
+        let cache: Arc<FileMetadataCache> = Arc::new(DefaultCache::new(1024));
+        let source = ParquetSource::new(Arc::new(Schema::empty()))
+            .with_parquet_file_reader_factory(Arc::new(
+                CachedParquetFileReaderFactory::new(store, cache),
+            ));
+        let factory = source.parquet_file_reader_factory().unwrap();
+        assert!(factory.is::<CachedParquetFileReaderFactory>());
+        assert!(
+            factory
+                .downcast_ref::<DefaultParquetFileReaderFactory>()
+                .is_none()

Review Comment:
   Done



##########
docs/source/library-user-guide/upgrading/56.0.0.md:
##########
@@ -1621,3 +1621,18 @@ let return_type: Option<DataType> = definition
 `CreateFunction::try_new` takes `Option<FieldRef>` for the return type.
 
 See [issue #18235](https://github.com/apache/datafusion/issues/18235) for 
details.
+
+### `ParquetFileReaderFactory` adds `Any` as a supertrait

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to