Skip to content

Commit 8403d96

Browse files
committed
required()
1 parent a7f33c1 commit 8403d96

File tree

3 files changed

+16
-84
lines changed

3 files changed

+16
-84
lines changed

integration-tests/src/main/java/org/apache/polaris/service/it/test/PolarisApplicationIntegrationTest.java

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -371,11 +371,8 @@ public void testIcebergCreateTablesInExternalCatalog() throws IOException {
371371
TableIdentifier.of(ns, "the_table"),
372372
new Schema(
373373
List.of(
374-
Types.NestedField.builder()
375-
.withId(1)
376-
.withName("theField")
377-
.ofType(Types.StringType.get())
378-
.build())))
374+
Types.NestedField.required(
375+
1, "theField", Types.StringType.get()))))
379376
.withLocation("file:///tmp/tables")
380377
.withSortOrder(SortOrder.unsorted())
381378
.withPartitionSpec(PartitionSpec.unpartitioned())
@@ -402,11 +399,8 @@ public void testIcebergCreateTablesWithWritePathBlocked() throws IOException {
402399
TableIdentifier.of(ns, "the_table"),
403400
new Schema(
404401
List.of(
405-
Types.NestedField.builder()
406-
.withId(1)
407-
.withName("theField")
408-
.ofType(Types.StringType.get())
409-
.build())))
402+
Types.NestedField.required(
403+
1, "theField", Types.StringType.get()))))
410404
.withSortOrder(SortOrder.unsorted())
411405
.withPartitionSpec(PartitionSpec.unpartitioned())
412406
.withProperties(Map.of("write.data.path", "s3://my-bucket/path/to/data"))
@@ -422,11 +416,8 @@ public void testIcebergCreateTablesWithWritePathBlocked() throws IOException {
422416
TableIdentifier.of(ns, "the_table"),
423417
new Schema(
424418
List.of(
425-
Types.NestedField.builder()
426-
.withId(1)
427-
.withName("theField")
428-
.ofType(Types.StringType.get())
429-
.build())))
419+
Types.NestedField.required(
420+
1, "theField", Types.StringType.get()))))
430421
.withSortOrder(SortOrder.unsorted())
431422
.withPartitionSpec(PartitionSpec.unpartitioned())
432423
.withProperties(Map.of("write.metadata.path", "s3://my-bucket/path/to/data"))
@@ -463,13 +454,7 @@ public void testIcebergRegisterTableInExternalCatalog() throws IOException {
463454
.assignUUID()
464455
.addPartitionSpec(PartitionSpec.unpartitioned())
465456
.addSortOrder(SortOrder.unsorted())
466-
.addSchema(
467-
new Schema(
468-
Types.NestedField.builder()
469-
.withId(1)
470-
.withName("col1")
471-
.ofType(Types.StringType.get())
472-
.build()))
457+
.addSchema(new Schema(Types.NestedField.required(1, "col1", Types.StringType.get())))
473458
.build();
474459
TableMetadataParser.write(tableMetadata, fileIo.newOutputFile(metadataLocation));
475460

@@ -505,12 +490,7 @@ public void testIcebergUpdateTableInExternalCatalog() throws IOException {
505490
String location = baseLocation.resolve("testIcebergUpdateTableInExternalCatalog").toString();
506491
String metadataLocation = location + "/metadata/000001-494949494949494949.metadata.json";
507492

508-
Types.NestedField col1 =
509-
Types.NestedField.builder()
510-
.withId(1)
511-
.withName("col1")
512-
.ofType(Types.StringType.get())
513-
.build();
493+
Types.NestedField col1 = Types.NestedField.required(1, "col1", Types.StringType.get());
514494
TableMetadata tableMetadata =
515495
TableMetadata.buildFromEmpty()
516496
.setLocation(location)
@@ -565,13 +545,7 @@ public void testIcebergDropTableInExternalCatalog() throws IOException {
565545
.assignUUID()
566546
.addPartitionSpec(PartitionSpec.unpartitioned())
567547
.addSortOrder(SortOrder.unsorted())
568-
.addSchema(
569-
new Schema(
570-
Types.NestedField.builder()
571-
.withId(1)
572-
.withName("col1")
573-
.ofType(Types.StringType.get())
574-
.build()))
548+
.addSchema(new Schema(Types.NestedField.required(1, "col1", Types.StringType.get())))
575549
.build();
576550
TableMetadataParser.write(tableMetadata, fileIo.newOutputFile(metadataLocation));
577551

integration-tests/src/main/java/org/apache/polaris/service/it/test/PolarisRestCatalogIntegrationTest.java

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -600,13 +600,7 @@ public void testLoadTableWithAccessDelegationForExternalCatalogWithConfigDisable
600600
restCatalog.createNamespace(ns1);
601601
TableMetadata tableMetadata =
602602
TableMetadata.newTableMetadata(
603-
new Schema(
604-
List.of(
605-
Types.NestedField.builder()
606-
.withId(1)
607-
.withName("col1")
608-
.ofType(Types.StringType.get())
609-
.build())),
603+
new Schema(List.of(Types.NestedField.required(1, "col1", new Types.StringType()))),
610604
PartitionSpec.unpartitioned(),
611605
externalCatalogBase + "/ns1/my_table",
612606
Map.of());
@@ -641,13 +635,7 @@ public void testLoadTableWithoutAccessDelegationForExternalCatalogWithConfigDisa
641635
restCatalog.createNamespace(ns1);
642636
TableMetadata tableMetadata =
643637
TableMetadata.newTableMetadata(
644-
new Schema(
645-
List.of(
646-
Types.NestedField.builder()
647-
.withId(1)
648-
.withName("col1")
649-
.ofType(Types.StringType.get())
650-
.build())),
638+
new Schema(List.of(Types.NestedField.required(1, "col1", new Types.StringType()))),
651639
PartitionSpec.unpartitioned(),
652640
externalCatalogBase + "/ns1/my_table",
653641
Map.of());
@@ -681,13 +669,7 @@ public void testLoadTableWithAccessDelegationForExternalCatalogWithConfigEnabled
681669
restCatalog.createNamespace(ns1);
682670
TableMetadata tableMetadata =
683671
TableMetadata.newTableMetadata(
684-
new Schema(
685-
List.of(
686-
Types.NestedField.builder()
687-
.withId(1)
688-
.withName("col1")
689-
.ofType(Types.StringType.get())
690-
.build())),
672+
new Schema(List.of(Types.NestedField.required(1, "col1", new Types.StringType()))),
691673
PartitionSpec.unpartitioned(),
692674
externalCatalogBase + "/ns1/my_table",
693675
Map.of());
@@ -718,13 +700,7 @@ public void testLoadTableTwiceWithETag() {
718700
restCatalog.createNamespace(ns1);
719701
TableMetadata tableMetadata =
720702
TableMetadata.newTableMetadata(
721-
new Schema(
722-
List.of(
723-
Types.NestedField.builder()
724-
.withId(1)
725-
.withName("col1")
726-
.ofType(Types.StringType.get())
727-
.build())),
703+
new Schema(List.of(Types.NestedField.required(1, "col1", new Types.StringType()))),
728704
PartitionSpec.unpartitioned(),
729705
"file:///tmp/ns1/my_table",
730706
Map.of());
@@ -771,13 +747,7 @@ public void testRegisterAndLoadTableWithReturnedETag() {
771747
restCatalog.createNamespace(ns1);
772748
TableMetadata tableMetadata =
773749
TableMetadata.newTableMetadata(
774-
new Schema(
775-
List.of(
776-
Types.NestedField.builder()
777-
.withId(1)
778-
.withName("col1")
779-
.ofType(Types.StringType.get())
780-
.build())),
750+
new Schema(List.of(Types.NestedField.required(1, "col1", new Types.StringType()))),
781751
PartitionSpec.unpartitioned(),
782752
"file:///tmp/ns1/my_table",
783753
Map.of());
@@ -823,13 +793,7 @@ public void testCreateAndLoadTableWithReturnedEtag() {
823793
restCatalog.createNamespace(ns1);
824794
TableMetadata tableMetadata =
825795
TableMetadata.newTableMetadata(
826-
new Schema(
827-
List.of(
828-
Types.NestedField.builder()
829-
.withId(1)
830-
.withName("col1")
831-
.ofType(Types.StringType.get())
832-
.build())),
796+
new Schema(List.of(Types.NestedField.required(1, "col1", new Types.StringType()))),
833797
PartitionSpec.unpartitioned(),
834798
"file:///tmp/ns1/my_table",
835799
Map.of());

quarkus/service/src/test/java/org/apache/polaris/service/quarkus/task/TaskTestUtils.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,7 @@ static TableMetadata writeTableMetadata(
100100
tmBuilder
101101
.setLocation("path/to/table")
102102
.addSchema(
103-
new Schema(
104-
List.of(
105-
Types.NestedField.builder()
106-
.withId(1)
107-
.withName("field1")
108-
.ofType(Types.StringType.get())
109-
.build())))
103+
new Schema(List.of(Types.NestedField.required(1, "field1", Types.StringType.get()))))
110104
.addSortOrder(SortOrder.unsorted())
111105
.assignUUID(UUID.randomUUID().toString())
112106
.addPartitionSpec(PartitionSpec.unpartitioned());

0 commit comments

Comments
 (0)