rdblue commented on issue #806: Fix NPE when calling locationProvider() in HadoopTableOperations with no current metadata URL: https://github.com/apache/incubator-iceberg/pull/806#issuecomment-587185576 @waterlx, the problem is that `HadoopTableOperations` doesn't implement the optional `temp(TableMetadata)` method. That method is used to get a temporary `HadoopTableOperations` object for calls like `locationProvider()` that use table metadata. It is used by the `Transaction` system. Previously, Hadoop tables weren't used with the transactions created by `BaseMetastoreCatalog`, so we didn't have an implementation. Now that there is a `HadoopCatalog`, it needs this to avoid the problem you're hitting. Here's a quick implementation that I think should work: ```java @Override public TableOperations temp(TableMetadata uncommittedMetadata) { return new TableOperations() { @Override public TableMetadata current() { return uncommittedMetadata; } @Override public TableMetadata refresh() { throw new UnsupportedOperationException("Cannot call refresh on temporary table operations"); } @Override public void commit(TableMetadata base, TableMetadata metadata) { throw new UnsupportedOperationException("Cannot call commit on temporary table operations"); } @Override public String metadataFileLocation(String fileName) { return HadoopTableOperations.this.metadataFileLocation(fileName); } @Override public LocationProvider locationProvider() { return LocationProviders.locationsFor(uncommittedMetadata.location(), uncommittedMetadata.properties()); } @Override public FileIO io() { return HadoopTableOperations.this.io(); } @Override public EncryptionManager encryption() { return HadoopTableOperations.this.encryption(); } @Override public long newSnapshotId() { return HadoopTableOperations.this.newSnapshotId(); } }; } ```
---------------------------------------------------------------- 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] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
