Skip to content

Commit 8299d9b

Browse files
committed
fix typo
1 parent 5fdfa89 commit 8299d9b

File tree

1 file changed

+62
-26
lines changed

1 file changed

+62
-26
lines changed

crates/iceberg/src/writer/file_writer/parquet_writer.rs

Lines changed: 62 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ mod tests {
389389
async fn test_parquet_writer_with_complex_schema() -> Result<()> {
390390
let temp_dir = TempDir::new().unwrap();
391391
let file_io = FileIOBuilder::new_fs_io().build().unwrap();
392-
let loccation_gen =
392+
let location_gen =
393393
MockLocationGenerator::new(temp_dir.path().to_str().unwrap().to_string());
394394
let file_name_gen =
395395
DefaultFileNameGenerator::new("test".to_string(), None, DataFileFormat::Parquet);
@@ -410,7 +410,11 @@ mod tests {
410410
"sub_col",
411411
arrow_schema::DataType::Int64,
412412
true,
413-
)]
413+
)
414+
.with_metadata(HashMap::from([(
415+
PARQUET_FIELD_ID_META_KEY.to_string(),
416+
"-1".to_string(),
417+
)]))]
414418
.into(),
415419
),
416420
true,
@@ -424,11 +428,13 @@ mod tests {
424428
),
425429
arrow_schema::Field::new(
426430
"col3",
427-
arrow_schema::DataType::List(Arc::new(arrow_schema::Field::new(
428-
"item",
429-
arrow_schema::DataType::Int64,
430-
true,
431-
))),
431+
arrow_schema::DataType::List(Arc::new(
432+
arrow_schema::Field::new("item", arrow_schema::DataType::Int64, true)
433+
.with_metadata(HashMap::from([(
434+
PARQUET_FIELD_ID_META_KEY.to_string(),
435+
"-1".to_string(),
436+
)])),
437+
)),
432438
true,
433439
)
434440
.with_metadata(HashMap::from([(
@@ -445,11 +451,19 @@ mod tests {
445451
"sub_sub_col",
446452
arrow_schema::DataType::Int64,
447453
true,
448-
)]
454+
)
455+
.with_metadata(HashMap::from([(
456+
PARQUET_FIELD_ID_META_KEY.to_string(),
457+
"-1".to_string(),
458+
)]))]
449459
.into(),
450460
),
451461
true,
452-
)]
462+
)
463+
.with_metadata(HashMap::from([(
464+
PARQUET_FIELD_ID_META_KEY.to_string(),
465+
"-1".to_string(),
466+
)]))]
453467
.into(),
454468
),
455469
true,
@@ -463,11 +477,13 @@ mod tests {
463477
};
464478
let col0 = Arc::new(Int64Array::from_iter_values(vec![1; 1024])) as ArrayRef;
465479
let col1 = Arc::new(StructArray::new(
466-
vec![arrow_schema::Field::new(
467-
"sub_col",
468-
arrow_schema::DataType::Int64,
469-
true,
470-
)]
480+
vec![
481+
arrow_schema::Field::new("sub_col", arrow_schema::DataType::Int64, true)
482+
.with_metadata(HashMap::from([(
483+
PARQUET_FIELD_ID_META_KEY.to_string(),
484+
"-1".to_string(),
485+
)])),
486+
]
471487
.into(),
472488
vec![Arc::new(Int64Array::from_iter_values(vec![1; 1024]))],
473489
None,
@@ -476,14 +492,24 @@ mod tests {
476492
"test";
477493
1024
478494
])) as ArrayRef;
479-
let col3 = Arc::new(
480-
arrow_array::ListArray::from_iter_primitive::<Int64Type, _, _>(vec![
495+
let col3 = Arc::new({
496+
let list_parts = arrow_array::ListArray::from_iter_primitive::<Int64Type, _, _>(vec![
481497
Some(
482498
vec![Some(1),]
483499
);
484500
1024
485-
]),
486-
) as ArrayRef;
501+
])
502+
.into_parts();
503+
arrow_array::ListArray::new(
504+
Arc::new(list_parts.0.as_ref().clone().with_metadata(HashMap::from([(
505+
PARQUET_FIELD_ID_META_KEY.to_string(),
506+
"-1".to_string(),
507+
)]))),
508+
list_parts.1,
509+
list_parts.2,
510+
list_parts.3,
511+
)
512+
}) as ArrayRef;
487513
let col4 = Arc::new(StructArray::new(
488514
vec![arrow_schema::Field::new(
489515
"sub_col",
@@ -492,18 +518,28 @@ mod tests {
492518
"sub_sub_col",
493519
arrow_schema::DataType::Int64,
494520
true,
495-
)]
521+
)
522+
.with_metadata(HashMap::from([(
523+
PARQUET_FIELD_ID_META_KEY.to_string(),
524+
"-1".to_string(),
525+
)]))]
496526
.into(),
497527
),
498528
true,
499-
)]
529+
)
530+
.with_metadata(HashMap::from([(
531+
PARQUET_FIELD_ID_META_KEY.to_string(),
532+
"-1".to_string(),
533+
)]))]
500534
.into(),
501535
vec![Arc::new(StructArray::new(
502-
vec![arrow_schema::Field::new(
503-
"sub_sub_col",
504-
arrow_schema::DataType::Int64,
505-
true,
506-
)]
536+
vec![
537+
arrow_schema::Field::new("sub_sub_col", arrow_schema::DataType::Int64, true)
538+
.with_metadata(HashMap::from([(
539+
PARQUET_FIELD_ID_META_KEY.to_string(),
540+
"-1".to_string(),
541+
)])),
542+
]
507543
.into(),
508544
vec![Arc::new(Int64Array::from_iter_values(vec![1; 1024]))],
509545
None,
@@ -519,7 +555,7 @@ mod tests {
519555
WriterProperties::builder().build(),
520556
to_write.schema(),
521557
file_io.clone(),
522-
loccation_gen,
558+
location_gen,
523559
file_name_gen,
524560
)
525561
.build()

0 commit comments

Comments
 (0)