alamb commented on code in PR #25640:
URL: https://github.com/apache/datafusion/pull/25640#discussion_r4157836237


##########
datafusion-cli/src/main.rs:
##########
@@ -609,6 +619,72 @@ mod tests {
         Ok(())
     }
 
+    #[tokio::test]
+    async fn test_parquet_file_metadata_works() -> Result<(), DataFusionError> 
{
+        let ctx = SessionContext::new();
+        ctx.register_udtf(
+            "parquet_file_metadata",
+            Arc::new(ParquetFileMetadataFunc {}),
+        );
+
+        let sql = "SELECT * FROM 
parquet_file_metadata('../parquet-testing/data/int32_with_null_pages.parquet')";
+        let df = ctx.sql(sql).await?;
+        let rbs = df.collect().await?;
+
+        assert_snapshot!(batches_to_string(&rbs), @r"
+        
+-------------------------------------------------------+-------------------------------------------------------------------------------------+---------+----------+----------------+------------------------------+---------------+
+        | filename                                              | created_by   
                                                                       | 
version | num_rows | num_row_groups | key_value_metadata           | 
footer_length |
+        
+-------------------------------------------------------+-------------------------------------------------------------------------------------+---------+----------+----------------+------------------------------+---------------+
+        | ../parquet-testing/data/int32_with_null_pages.parquet | parquet-mr 
version 1.13.0-SNAPSHOT (build 433de8df33fcf31927f7b51456be9f53e64d48b9) | 1    
   | 1000     | 1              | {writer.model.name: example} | 273           |
+        
+-------------------------------------------------------+-------------------------------------------------------------------------------------+---------+----------+----------------+------------------------------+---------------+
+        ");
+
+        Ok(())
+    }
+
+    #[tokio::test]
+    async fn test_parquet_page_index_works() -> Result<(), DataFusionError> {
+        let ctx = SessionContext::new();
+        ctx.register_udtf("parquet_page_index", Arc::new(ParquetPageIndexFunc 
{}));
+
+        // page 2 only holds nulls, so it has no min or max
+        let sql = "SELECT * FROM 
parquet_page_index('../parquet-testing/data/int32_with_null_pages.parquet')";
+        let df = ctx.sql(sql).await?;
+        let rbs = df.collect().await?;
+
+        assert_snapshot!(batches_to_string(&rbs), @r"
+        
+-------------------------------------------------------+--------------+-----------+--------------+-----------------+--------+----------------------+-------------+------------+------------+

Review Comment:
   this is very cool -- thank you



-- 
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