@@ -630,6 +630,26 @@ mod tests {
630630 Spi :: run ( "copy test_table from 'https://ACCOUNT.dfs.fabric.microsoft.com';" ) . unwrap ( ) ;
631631 }
632632
633+ #[ pg_test]
634+ fn test_http_uri ( ) {
635+ object_store_cache_clear ( ) ;
636+
637+ let http_endpoint: String =
638+ std:: env:: var ( "HTTP_ENDPOINT" ) . expect ( "HTTP_ENDPOINT not found" ) ;
639+
640+ let http_uris = [
641+ format ! ( "{http_endpoint}/pg_parquet_test.parquet" ) ,
642+ format ! ( "{http_endpoint}/dummy/pg_parquet_test" ) ,
643+ ] ;
644+
645+ for http_uri in http_uris {
646+ let test_table = TestTable :: < i32 > :: new ( "int4" . into ( ) ) . with_uri ( http_uri) ;
647+
648+ test_table. insert ( "INSERT INTO test_expected (a) VALUES (1), (2), (null);" ) ;
649+ test_table. assert_expected_and_result_rows ( ) ;
650+ }
651+ }
652+
633653 #[ pg_test]
634654 #[ should_panic( expected = "relative path not allowed" ) ]
635655 fn test_copy_to_unsupported_scheme ( ) {
@@ -759,5 +779,50 @@ mod tests {
759779 ( "MicrosoftAzure" , "testcontainer2" , None )
760780 ]
761781 ) ;
782+
783+ // https scheme and base uri
784+ let http_uri =
785+ "https://d37ci6vzurychx.cloudfront.net/trip-data/yellow_tripdata_2024-03.parquet" ;
786+ Spi :: run ( format ! ( "SELECT * FROM parquet.schema('{http_uri}')" ) . as_str ( ) ) . unwrap ( ) ;
787+
788+ assert_eq ! (
789+ object_store_cache_items( ) ,
790+ vec![
791+ ( "AmazonS3" , "testbucket" , None ) ,
792+ ( "AmazonS3" , "testbucket2" , None ) ,
793+ ( "MicrosoftAzure" , "testcontainer" , None ) ,
794+ ( "HttpStore" , "https://d37ci6vzurychx.cloudfront.net" , None )
795+ ]
796+ ) ;
797+
798+ // https scheme and same base uri
799+ let http_uri =
800+ "https://d37ci6vzurychx.cloudfront.net/trip-data/yellow_tripdata_2024-04.parquet" ;
801+ Spi :: run ( format ! ( "SELECT * FROM parquet.schema('{http_uri}')" ) . as_str ( ) ) . unwrap ( ) ;
802+
803+ assert_eq ! (
804+ object_store_cache_items( ) ,
805+ vec![
806+ ( "AmazonS3" , "testbucket" , None ) ,
807+ ( "AmazonS3" , "testbucket2" , None ) ,
808+ ( "MicrosoftAzure" , "testcontainer" , None ) ,
809+ ( "HttpStore" , "https://d37ci6vzurychx.cloudfront.net" , None )
810+ ]
811+ ) ;
812+
813+ // https scheme and different base uri
814+ let http_uri = "https://www.filesampleshub.com/download/code/parquet/sample1.parquet" ;
815+ Spi :: run ( format ! ( "SELECT * FROM parquet.schema('{http_uri}')" ) . as_str ( ) ) . unwrap ( ) ;
816+
817+ assert_eq ! (
818+ object_store_cache_items( ) ,
819+ vec![
820+ ( "AmazonS3" , "testbucket" , None ) ,
821+ ( "AmazonS3" , "testbucket2" , None ) ,
822+ ( "MicrosoftAzure" , "testcontainer" , None ) ,
823+ ( "Http" , "https://d37ci6vzurychx.cloudfront.net" , None ) ,
824+ ( "HttpStore" , "https://www.filesampleshub.com" , None )
825+ ]
826+ ) ;
762827 }
763828}
0 commit comments