rdblue commented on a change in pull request #1373:
URL: https://github.com/apache/iceberg/pull/1373#discussion_r482619671
##########
File path: core/src/main/java/org/apache/iceberg/TableMetadataParser.java
##########
@@ -277,6 +286,22 @@ static TableMetadata fromJson(FileIO io, InputFile file,
JsonNode node) {
schema, TableMetadata.INITIAL_SPEC_ID, node.get(PARTITION_SPEC)));
}
+ JsonNode sortOrderArray = node.get(SORT_ORDERS);
+ List<SortOrder> sortOrders;
+ int defaultSortOrderId;
+ if (sortOrderArray != null) {
+ defaultSortOrderId = JsonUtil.getInt(DEFAULT_SORT_ORDER_ID, node);
+ ImmutableList.Builder<SortOrder> sortOrdersBuilder =
ImmutableList.builder();
+ for (JsonNode sortOrder : sortOrderArray) {
+ sortOrdersBuilder.add(SortOrderParser.fromJson(schema, sortOrder));
+ }
+ sortOrders = sortOrdersBuilder.build();
+ } else {
+ SortOrder defaultSortOrder = SortOrder.unsorted();
Review comment:
If the `SortOrder` list is required by v2, then I think that we should
add a check here that the table is v1. That way, we fail to read a table and
force recovery if a v2 table doesn't have an order list.
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]