From 936a4a29616a9b4f911d970e8c9311f6e67eef4e Mon Sep 17 00:00:00 2001 From: Kyle Bendickson Date: Thu, 2 Jun 2022 14:48:25 -0700 Subject: [PATCH 1/7] Core: Add SerDe tests for CreateTableRequest --- .../rest/requests/CreateTableRequest.java | 2 +- .../rest/requests/TestCreateTableRequest.java | 299 ++++++++++++++++++ 2 files changed, 300 insertions(+), 1 deletion(-) create mode 100644 core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java diff --git a/core/src/main/java/org/apache/iceberg/rest/requests/CreateTableRequest.java b/core/src/main/java/org/apache/iceberg/rest/requests/CreateTableRequest.java index 1b227b11c507..9c11d8429c35 100644 --- a/core/src/main/java/org/apache/iceberg/rest/requests/CreateTableRequest.java +++ b/core/src/main/java/org/apache/iceberg/rest/requests/CreateTableRequest.java @@ -43,7 +43,7 @@ public class CreateTableRequest implements RESTRequest { private UnboundPartitionSpec spec; private UnboundSortOrder order; private Map properties; - private Boolean stageCreate; + private Boolean stageCreate = false; public CreateTableRequest() { // Needed for Jackson Deserialization. diff --git a/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java b/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java new file mode 100644 index 000000000000..852f934ed360 --- /dev/null +++ b/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java @@ -0,0 +1,299 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.iceberg.rest.requests; + +import com.fasterxml.jackson.core.JsonProcessingException; +import java.util.Map; +import org.apache.iceberg.AssertHelpers; +import org.apache.iceberg.NullOrder; +import org.apache.iceberg.PartitionSpec; +import org.apache.iceberg.PartitionSpecParser; +import org.apache.iceberg.Schema; +import org.apache.iceberg.SchemaParser; +import org.apache.iceberg.SortOrder; +import org.apache.iceberg.SortOrderParser; +import org.apache.iceberg.catalog.Namespace; +import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap; +import org.apache.iceberg.relocated.com.google.common.collect.Maps; +import org.apache.iceberg.rest.RequestResponseTestBase; +import org.apache.iceberg.types.Types; +import org.junit.Assert; +import org.junit.Test; + +import static org.apache.iceberg.types.Types.NestedField.optional; +import static org.apache.iceberg.types.Types.NestedField.required; + +public class TestCreateTableRequest extends RequestResponseTestBase { + + /* Values used to fill in request fields */ + private static final Namespace NAMESPACE = Namespace.of("accounting", "tax"); + private static final Map SAMPLE_PROPERTIES = ImmutableMap.of("owner", "Hank"); + private static final Map EMPTY_PROPERTIES = ImmutableMap.of(); + private static final String SAMPLE_NAME = "test_tbl"; + private static final String SAMPLE_LOCATION = "file://tmp/location/"; + private static final Schema SAMPLE_SCHEMA = new Schema( + required(1, "id", Types.IntegerType.get()), + optional(2, "data", Types.StringType.get())); + private static final String SAMPLE_SCHEMA_JSON = SchemaParser.toJson(SAMPLE_SCHEMA); + private static final PartitionSpec SAMPLE_SPEC = PartitionSpec.builderFor(SAMPLE_SCHEMA) + .bucket("id", 16) + .build(); + private static final SortOrder SAMPLE_WRITE_ORDER = SortOrder.builderFor(SAMPLE_SCHEMA) + .asc("data", NullOrder.NULLS_LAST) + .build(); + + @Test + // Test cases that are JSON that can be created via the Builder + public void testRoundTripSerDe() throws JsonProcessingException { + String fullJsonRaw = + "{\"name\":\"test_tbl\",\"location\":\"file://tmp/location/\",\"schema\":{\"type\":\"struct\"," + + "\"schema-id\":0,\"fields\":[{\"id\":1,\"name\":\"id\",\"required\":true,\"type\":\"int\"}," + + "{\"id\":2,\"name\":\"data\",\"required\":false,\"type\":\"string\"}]},\"spec\":{\"spec-id\":0," + + "\"fields\":[{\"name\":\"id_bucket\",\"transform\":\"bucket[16]\",\"source-id\":1,\"field-id\":1000}]}," + + "\"order\":{\"order-id\":1,\"fields\":" + + "[{\"transform\":\"identity\",\"source-id\":2,\"direction\":\"asc\",\"null-order\":\"nulls-last\"}]}," + + "\"properties\":{\"owner\":\"Hank\"},\"stageCreate\":false}"; + + CreateTableRequest req = CreateTableRequest.builder() + .withName(SAMPLE_NAME) + .withLocation(SAMPLE_LOCATION) + .withSchema(SAMPLE_SCHEMA) + .setProperties(SAMPLE_PROPERTIES) + .withPartitionSpec(SAMPLE_SPEC) + .withWriteOrder(SAMPLE_WRITE_ORDER) + .build(); + + assertRoundTripSerializesEquallyFrom(fullJsonRaw, req); + + // The same JSON but using existing parsers for clarity + String fullJson = String.format( + "{\"name\":\"%s\",\"location\":\"%s\",\"schema\":%s,\"spec\":%s," + + "\"order\":%s,\"properties\":%s,\"stageCreate\":%b}", + SAMPLE_NAME, SAMPLE_LOCATION, SchemaParser.toJson(SAMPLE_SCHEMA), + PartitionSpecParser.toJson(SAMPLE_SPEC.toUnbound()), SortOrderParser.toJson(SAMPLE_WRITE_ORDER.toUnbound()), + mapper().writeValueAsString(SAMPLE_PROPERTIES), false); + + assertRoundTripSerializesEquallyFrom(fullJson, req); + + // Partition spec and write order can be null or use PartitionSpec.unpartitioned() and SortOrder.unsorted() + String jsonWithExplicitUnsortedUnordered = String.format( + "{\"name\":\"%s\",\"location\":null,\"schema\":%s,\"spec\":%s," + + "\"order\":%s,\"properties\":{},\"stageCreate\":%b}", + SAMPLE_NAME, SchemaParser.toJson(SAMPLE_SCHEMA), + PartitionSpecParser.toJson(PartitionSpec.unpartitioned()), + SortOrderParser.toJson(SortOrder.unsorted().toUnbound()), + /* stageCreate */ false); + + CreateTableRequest reqOnlyRequiredFieldsExplicitDefaults = CreateTableRequest.builder() + .withName(SAMPLE_NAME) + .withLocation(null) + .withSchema(SAMPLE_SCHEMA) + .setProperties(EMPTY_PROPERTIES) + .withPartitionSpec(PartitionSpec.unpartitioned()) + .withWriteOrder(SortOrder.unsorted()) + .build(); + + assertRoundTripSerializesEquallyFrom( + jsonWithExplicitUnsortedUnordered, reqOnlyRequiredFieldsExplicitDefaults); + + String jsonOnlyRequiredFieldsNullAsDefault = String.format( + "{\"name\":\"%s\",\"location\":null,\"schema\":%s,\"spec\":null,\"order\":null,\"properties\":{}," + + "\"stageCreate\":false}", + SAMPLE_NAME, SchemaParser.toJson(SAMPLE_SCHEMA)); + + CreateTableRequest reqOnlyRequiredFieldsMissingDefaults = CreateTableRequest.builder() + .withName(SAMPLE_NAME) + .withSchema(SAMPLE_SCHEMA) + .withPartitionSpec(null) + .withWriteOrder(null) + .build(); + + assertRoundTripSerializesEquallyFrom( + jsonOnlyRequiredFieldsNullAsDefault, reqOnlyRequiredFieldsMissingDefaults); + } + + @Test + // Test cases that can't be constructed with our Builder class but that will parse correctly + public void testCanDeserializeWithoutDefaultValues() throws JsonProcessingException { + // Name and schema are only two required fields + String jsonOnlyRequiredFieldsMissingDefaults = String.format( + "{\"name\":\"%s\",\"schema\":%s}", SAMPLE_NAME, SchemaParser.toJson(SAMPLE_SCHEMA)); + + CreateTableRequest reqOnlyRequiredFieldsMissingDefaults = CreateTableRequest.builder() + .withName(SAMPLE_NAME) + .withSchema(SAMPLE_SCHEMA) + .build(); + + assertEquals(deserialize(jsonOnlyRequiredFieldsMissingDefaults), reqOnlyRequiredFieldsMissingDefaults); + + String jsonOnlyRequiredFieldsExplicitNullLocation = String.format( + "{\"name\":\"%s\",\"location\":null,\"schema\":%s,\"stageCreate\":%b}", SAMPLE_NAME, SchemaParser.toJson(SAMPLE_SCHEMA), false); + + assertEquals( + deserialize(jsonOnlyRequiredFieldsExplicitNullLocation), reqOnlyRequiredFieldsMissingDefaults); + } + + @Test + public void testDeserializeInvalidRequest() { + String jsonMissingSchema = + "{\"name\":\"foo\",\"location\":null,\"spec\":null,\"order\":null,\"properties\":{},\"stageCreate\":false}"; + AssertHelpers.assertThrows( + "A JSON request with the keys spelled incorrectly should fail to deserialize and validate", + IllegalArgumentException.class, + "Invalid schema: null", + () -> deserialize(jsonMissingSchema) + ); + + String jsonMissingName = String.format( + "{\"location\":null,\"schema\":%s,\"spec\":null,\"order\":null,\"properties\":{}," + + "\"stageCreate\":false}", SAMPLE_SCHEMA_JSON); + AssertHelpers.assertThrows( + "A JSON request with the keys spelled incorrectly should fail to deserialize and validate", + IllegalArgumentException.class, + "Invalid table name: null", + () -> deserialize(jsonMissingName) + ); + + String jsonIncorrectTypeForProperties = String.format( + "{\"name\":\"foo\",\"location\":null,\"schema\":%s,\"spec\":null,\"order\":null,\"properties\":[]," + + "\"stageCreate\":false}", SAMPLE_SCHEMA_JSON); + AssertHelpers.assertThrows( + "A JSON request with incorrect types for fields should fail to parse and validate", + JsonProcessingException.class, + () -> deserialize(jsonIncorrectTypeForProperties) + ); + + AssertHelpers.assertThrows( + "An empty JSON object should not parse into a CreateNamespaceRequest instance that passes validation", + IllegalArgumentException.class, + "Invalid table name: null", + () -> deserialize("{}") + ); + + AssertHelpers.assertThrows( + "An empty JSON request should fail to deserialize", + IllegalArgumentException.class, + () -> deserialize(null) + ); + } + + @Test + public void testBuilderDoesNotBuildInvalidRequests() { + AssertHelpers.assertThrows( + "The builder should not allow using null for the namespace", + NullPointerException.class, + "Invalid name: null", + () -> CreateTableRequest.builder().withName(null) + ); + + AssertHelpers.assertThrows( + "The builder should not allow using null for the schema", + NullPointerException.class, + "Invalid schema: null", + () -> CreateTableRequest.builder().withSchema(null) + ); + + AssertHelpers.assertThrows( + "The builder should not allow passing a null collection of properties", + NullPointerException.class, + "Invalid collection of properties: null", + () -> CreateTableRequest.builder().setProperties(null) + ); + + Map mapWithNullKey = Maps.newHashMap(); + mapWithNullKey.put(null, "hello"); + AssertHelpers.assertThrows( + "The builder should not allow using null as a key in the properties to set", + IllegalArgumentException.class, + "Invalid property: null", + () -> CreateTableRequest.builder().setProperties(mapWithNullKey) + ); + + Map mapWithNullValue = Maps.newHashMap(); + mapWithNullValue.put("a", null); + mapWithNullValue.put("b", "b"); + AssertHelpers.assertThrows( + "The builder should not allow using null as a value in the properties to set", + IllegalArgumentException.class, + "Invalid value for properties [a]: null", + () -> CreateTableRequest.builder().setProperties(mapWithNullValue).build() + ); + + AssertHelpers.assertThrows( + "The builder should not allow using null as a value when setting a single property", + IllegalArgumentException.class, + "Invalid value for property foo: null", + () -> CreateTableRequest.builder().setProperty("foo", null) + ); + + AssertHelpers.assertThrows( + "The builder should not allow using null as a key when setting a single property", + IllegalArgumentException.class, + "Invalid value for properties [a]: null", + () -> CreateTableRequest.builder().setProperties(mapWithNullValue).build() + ); + } + + @Override + public String[] allFieldsFromSpec() { + return new String[] {"name", "location", "schema", "spec", "order", "properties", "stageCreate"}; + } + + @Override + public CreateTableRequest createExampleInstance() { + return CreateTableRequest.builder() + .withName(SAMPLE_NAME) + .withLocation(SAMPLE_LOCATION) + .withSchema(SAMPLE_SCHEMA) + .withPartitionSpec(SAMPLE_SPEC) + .withWriteOrder(SAMPLE_WRITE_ORDER) + .setProperties(SAMPLE_PROPERTIES) + .stageCreate() + .build(); + } + + @Override + public void assertEquals(CreateTableRequest actual, CreateTableRequest expected) { + Assert.assertEquals("Name should be the same", expected.name(), actual.name()); + Assert.assertEquals("Location should be the same if provided", expected.location(), actual.location()); + Assert.assertTrue("Schemas should be equivalent", expected.schema().sameSchema(actual.schema())); + // schemaId is ignored in sameSchema + Assert.assertEquals("Schema ID should be equal", expected.schema().schemaId(), actual.schema().schemaId()); + Assert.assertEquals("Partition spec should be equal", expected.spec(), actual.spec()); + Assert.assertEquals("Write [sort] order should be the same", expected.writeOrder(), actual.writeOrder()); + Assert.assertEquals("Properties should be the same", expected.properties(), actual.properties()); + Assert.assertEquals("Stage create should be equal", expected.stageCreate(), actual.stageCreate()); + // For printing JSON values + // TODO - Remove me. +// try { +// Assert.assertEquals("Objects should have same represenation via object mapper", +// mapper().writeValueAsString(expected), mapper().writeValueAsString(actual)); +// } catch (JsonProcessingException e) { +// Assert.assertEquals("Some random stuff to suppress warnings", e.getMessage(), "fake message"); +// } + } + + @Override + public CreateTableRequest deserialize(String json) throws JsonProcessingException { + CreateTableRequest request = mapper().readValue(json, CreateTableRequest.class); + request.validate(); + return request; + } +} From e8e10dc4c2cad55e93c800de696b790169e5c91c Mon Sep 17 00:00:00 2001 From: Kyle Bendickson Date: Wed, 15 Jun 2022 11:35:42 -0700 Subject: [PATCH 2/7] Fix checkstyle --- .../apache/iceberg/rest/requests/TestCreateTableRequest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java b/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java index 852f934ed360..ef1ecefa9980 100644 --- a/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java +++ b/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java @@ -144,7 +144,7 @@ public void testCanDeserializeWithoutDefaultValues() throws JsonProcessingExcept assertEquals(deserialize(jsonOnlyRequiredFieldsMissingDefaults), reqOnlyRequiredFieldsMissingDefaults); String jsonOnlyRequiredFieldsExplicitNullLocation = String.format( - "{\"name\":\"%s\",\"location\":null,\"schema\":%s,\"stageCreate\":%b}", SAMPLE_NAME, SchemaParser.toJson(SAMPLE_SCHEMA), false); + "{\"name\":\"%s\",\"location\":null,\"schema\":%s,\"stageCreate\":%b}", SAMPLE_NAME, SAMPLE_SCHEMA_JSON, false); assertEquals( deserialize(jsonOnlyRequiredFieldsExplicitNullLocation), reqOnlyRequiredFieldsMissingDefaults); From b99c4ce101a1fd5569a368cadf226e06a33233df Mon Sep 17 00:00:00 2001 From: Kyle Bendickson Date: Wed, 15 Jun 2022 11:51:00 -0700 Subject: [PATCH 3/7] Collapse same schema and schemaID checks into one assertion --- .../rest/requests/TestCreateTableRequest.java | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java b/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java index ef1ecefa9980..27d126965823 100644 --- a/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java +++ b/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java @@ -273,21 +273,12 @@ public CreateTableRequest createExampleInstance() { public void assertEquals(CreateTableRequest actual, CreateTableRequest expected) { Assert.assertEquals("Name should be the same", expected.name(), actual.name()); Assert.assertEquals("Location should be the same if provided", expected.location(), actual.location()); - Assert.assertTrue("Schemas should be equivalent", expected.schema().sameSchema(actual.schema())); - // schemaId is ignored in sameSchema - Assert.assertEquals("Schema ID should be equal", expected.schema().schemaId(), actual.schema().schemaId()); + Assert.assertTrue("Schemas should be equivalent and have same schema id", + expected.schema().sameSchema(actual.schema()) && expected.schema().schemaId() == actual.schema().schemaId()); Assert.assertEquals("Partition spec should be equal", expected.spec(), actual.spec()); Assert.assertEquals("Write [sort] order should be the same", expected.writeOrder(), actual.writeOrder()); Assert.assertEquals("Properties should be the same", expected.properties(), actual.properties()); Assert.assertEquals("Stage create should be equal", expected.stageCreate(), actual.stageCreate()); - // For printing JSON values - // TODO - Remove me. -// try { -// Assert.assertEquals("Objects should have same represenation via object mapper", -// mapper().writeValueAsString(expected), mapper().writeValueAsString(actual)); -// } catch (JsonProcessingException e) { -// Assert.assertEquals("Some random stuff to suppress warnings", e.getMessage(), "fake message"); -// } } @Override From 28cf49cfa01d928a5c2f9399422aaa3a7eccc031 Mon Sep 17 00:00:00 2001 From: Kyle Bendickson Date: Wed, 15 Jun 2022 12:05:03 -0700 Subject: [PATCH 4/7] Test staging creation and not committing --- .../rest/requests/TestCreateTableRequest.java | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java b/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java index 27d126965823..5f6ca15c2186 100644 --- a/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java +++ b/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java @@ -82,15 +82,24 @@ public void testRoundTripSerDe() throws JsonProcessingException { assertRoundTripSerializesEquallyFrom(fullJsonRaw, req); - // The same JSON but using existing parsers for clarity - String fullJson = String.format( + // The same JSON but using existing parsers for clarity and staging the request instead of committing + String jsonStagedReq = String.format( "{\"name\":\"%s\",\"location\":\"%s\",\"schema\":%s,\"spec\":%s," + "\"order\":%s,\"properties\":%s,\"stageCreate\":%b}", SAMPLE_NAME, SAMPLE_LOCATION, SchemaParser.toJson(SAMPLE_SCHEMA), PartitionSpecParser.toJson(SAMPLE_SPEC.toUnbound()), SortOrderParser.toJson(SAMPLE_WRITE_ORDER.toUnbound()), - mapper().writeValueAsString(SAMPLE_PROPERTIES), false); + mapper().writeValueAsString(SAMPLE_PROPERTIES), true); - assertRoundTripSerializesEquallyFrom(fullJson, req); + CreateTableRequest stagedReq = CreateTableRequest.builder() + .withName(SAMPLE_NAME) + .withLocation(SAMPLE_LOCATION) + .withSchema(SAMPLE_SCHEMA) + .setProperties(SAMPLE_PROPERTIES) + .withPartitionSpec(SAMPLE_SPEC) + .withWriteOrder(SAMPLE_WRITE_ORDER) + .build(); + + assertRoundTripSerializesEquallyFrom(jsonStagedReq, req); // Partition spec and write order can be null or use PartitionSpec.unpartitioned() and SortOrder.unsorted() String jsonWithExplicitUnsortedUnordered = String.format( @@ -142,12 +151,6 @@ public void testCanDeserializeWithoutDefaultValues() throws JsonProcessingExcept .build(); assertEquals(deserialize(jsonOnlyRequiredFieldsMissingDefaults), reqOnlyRequiredFieldsMissingDefaults); - - String jsonOnlyRequiredFieldsExplicitNullLocation = String.format( - "{\"name\":\"%s\",\"location\":null,\"schema\":%s,\"stageCreate\":%b}", SAMPLE_NAME, SAMPLE_SCHEMA_JSON, false); - - assertEquals( - deserialize(jsonOnlyRequiredFieldsExplicitNullLocation), reqOnlyRequiredFieldsMissingDefaults); } @Test @@ -246,8 +249,8 @@ public void testBuilderDoesNotBuildInvalidRequests() { AssertHelpers.assertThrows( "The builder should not allow using null as a key when setting a single property", IllegalArgumentException.class, - "Invalid value for properties [a]: null", - () -> CreateTableRequest.builder().setProperties(mapWithNullValue).build() + "Invalid property: null", + () -> CreateTableRequest.builder().setProperty(null, "foo") ); } From 8867cbe264b85274fc0b1e2c1daac86b864bf6ae Mon Sep 17 00:00:00 2001 From: Kyle Bendickson Date: Wed, 15 Jun 2022 12:18:28 -0700 Subject: [PATCH 5/7] Add in missing set property call --- .../apache/iceberg/rest/requests/TestCreateTableRequest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java b/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java index 5f6ca15c2186..99f05fef4c59 100644 --- a/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java +++ b/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java @@ -94,9 +94,10 @@ public void testRoundTripSerDe() throws JsonProcessingException { .withName(SAMPLE_NAME) .withLocation(SAMPLE_LOCATION) .withSchema(SAMPLE_SCHEMA) - .setProperties(SAMPLE_PROPERTIES) + .setProperty("owner", "Hank") .withPartitionSpec(SAMPLE_SPEC) .withWriteOrder(SAMPLE_WRITE_ORDER) + .stageCreate() .build(); assertRoundTripSerializesEquallyFrom(jsonStagedReq, req); From fdfd68f6e4cd4a8cf57f40aa0952b220fd510dc8 Mon Sep 17 00:00:00 2001 From: Kyle Bendickson Date: Wed, 15 Jun 2022 12:48:21 -0700 Subject: [PATCH 6/7] Use correct request object for test with staged / uncommitted create table request --- .../apache/iceberg/rest/requests/TestCreateTableRequest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java b/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java index 99f05fef4c59..c2f286c9b788 100644 --- a/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java +++ b/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java @@ -100,7 +100,7 @@ public void testRoundTripSerDe() throws JsonProcessingException { .stageCreate() .build(); - assertRoundTripSerializesEquallyFrom(jsonStagedReq, req); + assertRoundTripSerializesEquallyFrom(jsonStagedReq, stagedReq); // Partition spec and write order can be null or use PartitionSpec.unpartitioned() and SortOrder.unsorted() String jsonWithExplicitUnsortedUnordered = String.format( From 46bcb86100a7703ff3429d76ad636805ec901bff Mon Sep 17 00:00:00 2001 From: Kyle Bendickson Date: Sun, 19 Jun 2022 20:57:07 -0700 Subject: [PATCH 7/7] Update core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java Fix added space Co-authored-by: Prashant Singh <35593236+singhpk234@users.noreply.github.com> --- .../apache/iceberg/rest/requests/TestCreateTableRequest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java b/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java index c2f286c9b788..b34c5c586c5f 100644 --- a/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java +++ b/core/src/test/java/org/apache/iceberg/rest/requests/TestCreateTableRequest.java @@ -90,7 +90,7 @@ public void testRoundTripSerDe() throws JsonProcessingException { PartitionSpecParser.toJson(SAMPLE_SPEC.toUnbound()), SortOrderParser.toJson(SAMPLE_WRITE_ORDER.toUnbound()), mapper().writeValueAsString(SAMPLE_PROPERTIES), true); - CreateTableRequest stagedReq = CreateTableRequest.builder() + CreateTableRequest stagedReq = CreateTableRequest.builder() .withName(SAMPLE_NAME) .withLocation(SAMPLE_LOCATION) .withSchema(SAMPLE_SCHEMA)