Skip to content

Commit f491df8

Browse files
committed
refine test
1 parent 4356784 commit f491df8

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

crates/e2e_test/testdata/docker-compose.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ services:
2424
- AWS_ACCESS_KEY_ID=admin
2525
- AWS_SECRET_ACCESS_KEY=password
2626
- AWS_REGION=us-east-1
27-
- CATALOG_CATOLOG__IMPL=org.apache.iceberg.jdbc.JdbcCatalog
2827
- CATALOG_URI=jdbc:sqlite:file:/tmp/iceberg_rest_mode=memory
2928
- CATALOG_WAREHOUSE=s3://icebergdata/demo
3029
- CATALOG_IO__IMPL=org.apache.iceberg.aws.s3.S3FileIO
@@ -37,7 +36,7 @@ services:
3736
- 8181
3837

3938
minio:
40-
image: minio/minio:RELEASE.2024-03-07T00-43-48Z
39+
image: minio/minio:latest
4140
environment:
4241
- MINIO_ROOT_USER=admin
4342
- MINIO_ROOT_PASSWORD=password
@@ -50,7 +49,7 @@ services:
5049
mc:
5150
depends_on:
5251
- minio
53-
image: minio/mc:RELEASE.2024-03-07T00-31-49Z
52+
image: minio/mc:latest
5453
environment:
5554
- AWS_ACCESS_KEY_ID=admin
5655
- AWS_SECRET_ACCESS_KEY=password

crates/e2e_test/tests/append_data_file_test.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ use iceberg::{Catalog, Namespace, NamespaceIdent, TableCreation};
3232
use iceberg_catalog_rest::{RestCatalog, RestCatalogConfig};
3333
use iceberg_test_utils::docker::DockerCompose;
3434
use iceberg_test_utils::{normalize_test_name, set_up};
35+
use parquet::arrow::ParquetRecordBatchStreamBuilder;
3536
use parquet::file::properties::WriterProperties;
3637
use port_scanner::scan_port_addr;
3738
use std::collections::HashMap;
@@ -169,6 +170,26 @@ async fn test_append_data_file() {
169170
data_file_writer.write(batch.clone()).await.unwrap();
170171
let data_file = data_file_writer.close().await.unwrap();
171172

173+
// check parquet file schema
174+
let batch_stream_builder = ParquetRecordBatchStreamBuilder::new(
175+
table
176+
.file_io()
177+
.new_input(data_file[0].file_path())
178+
.unwrap()
179+
.reader()
180+
.await
181+
.unwrap(),
182+
)
183+
.await
184+
.unwrap();
185+
let field_ids: Vec<i32> = batch_stream_builder
186+
.parquet_schema()
187+
.columns()
188+
.iter()
189+
.map(|col| col.self_type().get_basic_info().id())
190+
.collect();
191+
assert_eq!(field_ids, vec![1, 2, 3]);
192+
172193
// commit result
173194
let tx = Transaction::new(&table);
174195
let mut append_action = tx.fast_append(None, vec![]).unwrap();

crates/iceberg/src/spec/values.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,11 @@ impl Struct {
11471147
},
11481148
)
11491149
}
1150+
1151+
/// Return fields in the struct.
1152+
pub fn fields(&self) -> &[Literal] {
1153+
&self.fields
1154+
}
11501155
}
11511156

11521157
impl Index<usize> for Struct {

crates/iceberg/src/transaction.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,8 @@ impl<'a> FastAppendAction<'a> {
358358
writer.write(manifest).await
359359
}
360360

361+
// # TODO:
362+
// Complete the summary.
361363
fn summary(&self) -> Summary {
362364
Summary {
363365
operation: crate::spec::Operation::Append,
@@ -750,7 +752,7 @@ mod tests {
750752
}
751753

752754
#[tokio::test]
753-
async fn test_merge_snapshot_actio() {
755+
async fn test_merge_snapshot_action() {
754756
let table = make_v2_minimal_table();
755757
let tx = Transaction::new(&table);
756758

0 commit comments

Comments
 (0)