ajantha-bhat commented on code in PR #8909: URL: https://github.com/apache/iceberg/pull/8909#discussion_r1399218687
########## nessie/src/main/java/org/apache/iceberg/nessie/NessieIcebergClient.java: ########## @@ -540,4 +630,72 @@ public void close() { api.close(); } } + + public void commitView( + ViewMetadata base, + ViewMetadata metadata, + String newMetadataLocation, + String contentId, + ContentKey key) + throws NessieConflictException, NessieNotFoundException { + UpdateableReference updateableReference = getRef(); + + updateableReference.checkMutable(); + + Branch current = (Branch) updateableReference.getReference(); + Branch expectedHead = current; + if (base != null) { + String metadataCommitId = + base.properties() + .getOrDefault( + NessieTableOperations.NESSIE_COMMIT_ID_PROPERTY, expectedHead.getHash()); + if (metadataCommitId != null) { + expectedHead = Branch.of(expectedHead.getName(), metadataCommitId); + } + } + + long versionId = metadata.currentVersion().versionId(); + + ImmutableIcebergView.Builder newViewBuilder = ImmutableIcebergView.builder(); + // Directly casting to `SQLViewRepresentation` as only SQL type exist in + // `ViewRepresentation.Type`. + // Assuming only one engine's dialect will be used, Nessie IcebergView currently holds one + // representation. + // View loaded from catalog will have all the representation as it parses the view metadata + // file. + SQLViewRepresentation sqlViewRepresentation = + (SQLViewRepresentation) metadata.currentVersion().representations().get(0); Review Comment: > I don't understand how this related to "global state" - those things are not related to each other at all. `IcebergTable` model used to only store table metadata location. But then it started storing other info like schema id, snapshot id etc to support global state. The `IcebergView` model developed was also based on the design of `IcebergTable` (which was based on global state). Else just View metadata location was enough. Thats how I thought it is designed. > Nessie should really not store the dialect nor the SQL representation Ok. I will update as per this. -- 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. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org