22
22
import static io .deephaven .engine .testutil .TstUtils .assertTableEquals ;
23
23
import static io .deephaven .parquet .table .ParquetTools .readTable ;
24
24
import static org .junit .Assert .assertEquals ;
25
+ import static org .junit .Assert .assertTrue ;
25
26
26
27
/**
27
28
* These tests verify the behavior of Parquet implementation when reading against remote S3 servers.
@@ -100,6 +101,59 @@ public void readSampleParquetFilesFromPublicS3Part3() {
100
101
readTable ("s3://redshift-downloads/redset/serverless/full.parquet" , readInstructions ).head (10 ).select ();
101
102
}
102
103
104
+ @ Test
105
+ public void readSampleParquetFromPublicGCS () {
106
+ Assume .assumeTrue ("Skipping test because s3 testing disabled." , ENABLE_REMOTE_S3_TESTING );
107
+ final Table tableWithEndpointOverride ;
108
+ {
109
+ final ParquetInstructions readInstructions = new ParquetInstructions .Builder ()
110
+ .setSpecialInstructions (S3Instructions .builder ()
111
+ .readTimeout (Duration .ofSeconds (60 ))
112
+ .credentials (Credentials .anonymous ())
113
+ .regionName ("us-east-1" )
114
+ .endpointOverride ("https://storage.googleapis.com" )
115
+ .build ())
116
+ .build ();
117
+ tableWithEndpointOverride = ParquetTools .readTable (
118
+ "s3://cloud-samples-data/bigquery/us-states/us-states.parquet" , readInstructions ).select ();
119
+ assertEquals (2 , tableWithEndpointOverride .numColumns ());
120
+ assertEquals (50 , tableWithEndpointOverride .size ());
121
+ }
122
+
123
+ final Table tableWithoutEndpointOverride ;
124
+ {
125
+ final ParquetInstructions readInstructions = new ParquetInstructions .Builder ()
126
+ .setSpecialInstructions (S3Instructions .builder ()
127
+ .readTimeout (Duration .ofSeconds (60 ))
128
+ .regionName ("us-east-1" )
129
+ .credentials (Credentials .anonymous ())
130
+ .build ())
131
+ .build ();
132
+ tableWithoutEndpointOverride = ParquetTools .readTable (
133
+ "gs://cloud-samples-data/bigquery/us-states/us-states.parquet" , readInstructions ).select ();
134
+ assertEquals (2 , tableWithoutEndpointOverride .numColumns ());
135
+ assertEquals (50 , tableWithoutEndpointOverride .size ());
136
+ }
137
+ assertTableEquals (tableWithEndpointOverride , tableWithoutEndpointOverride );
138
+ }
139
+
140
+ @ Test
141
+ public void testReadFromGCSFailure () {
142
+ final ParquetInstructions readInstructions = new ParquetInstructions .Builder ()
143
+ .setSpecialInstructions (S3Instructions .builder ()
144
+ .readTimeout (Duration .ofSeconds (60 ))
145
+ .credentials (Credentials .anonymous ())
146
+ .endpointOverride ("https://storage.com" )
147
+ .build ())
148
+ .build ();
149
+ try {
150
+ ParquetTools .readTable (
151
+ "gs://cloud-samples-data/bigquery/us-states/us-states.parquet" , readInstructions ).select ();
152
+ } catch (final IllegalArgumentException e ) {
153
+ assertTrue (e .toString ().contains ("endpoint override" ));
154
+ }
155
+ }
156
+
103
157
@ Test
104
158
public void readKeyValuePartitionedParquetFromPublicS3 () {
105
159
Assume .assumeTrue ("Skipping test because s3 testing disabled." , ENABLE_REMOTE_S3_TESTING );
@@ -120,6 +174,9 @@ public void readKeyValuePartitionedParquetFromPublicS3() {
120
174
assertEquals (2 , table .numColumns ());
121
175
}
122
176
177
+ /**
178
+ * The follow test reads from Deephaven's s3 bucket, thus requires the credentials to be set up.
179
+ */
123
180
@ Test
124
181
public void readMetadataPartitionedParquetFromS3 () {
125
182
Assume .assumeTrue ("Skipping test because s3 testing disabled." , ENABLE_REMOTE_S3_TESTING );
0 commit comments