You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/03/13 03:19:53 UTC

[GitHub] [iceberg] yyanyy commented on a change in pull request #2096: Core: add schema id and schemas to table metadata

yyanyy commented on a change in pull request #2096:
URL: https://github.com/apache/iceberg/pull/2096#discussion_r593551188



##########
File path: core/src/test/java/org/apache/iceberg/TestTableMetadata.java
##########
@@ -599,4 +639,81 @@ public void testUpdateSortOrder() {
     Assert.assertEquals("Should be nulls first",
         NullOrder.NULLS_FIRST, sortedByX.sortOrder().fields().get(0).nullOrder());
   }
+
+  @Test
+  public void testUpdateSchema() {
+    Schema schema = new Schema(0,
+        Types.NestedField.required(1, "y", Types.LongType.get(), "comment")
+    );
+    TableMetadata freshTable = TableMetadata.newTableMetadata(
+        schema, PartitionSpec.unpartitioned(), null, ImmutableMap.of());
+    Assert.assertEquals("Should use TableMetadata.INITIAL_SCHEMA_ID for current schema id",
+        TableMetadata.INITIAL_SCHEMA_ID, freshTable.currentSchemaId());

Review comment:
       Do you mean to change the schema id supplied to `TableMetadata.newTableMetadata` to be non-0? Actually in `TableMetadata` the input schema Id will be ignored and always assign from 0, so changing this will break the test... Although I think this current behavior should be fine since I think this method is only called when creating a new table, so there shouldn't be any existing schema within the table that will collide on schema ID. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org