During the implementation of views in HiveCatalog, we have found that we are duplicating huge amounts of code for view management (creation, deletion, commits). Often we have to use the same method names, but the interfaces are unrelated to the moment.
This similarity highlights that the interfaces define the same behaviour, and it would be good to formalize it by adding a common ancestor for them. Thanks, Peter Naveen Kumar <nk1...@gmail.com> ezt írta (időpont: 2024. jan. 17., Sze, 12:16): > Hi Iceberg Community, > > Currently there is no relation between TableMetadata > <https://github.com/apache/iceberg/blob/b3273276fa4bac384b2429b7218fd18b242beefe/core/src/main/java/org/apache/iceberg/TableMetadata.java> > and ViewMetadata > <https://github.com/apache/iceberg/blob/b3273276fa4bac384b2429b7218fd18b242beefe/core/src/main/java/org/apache/iceberg/view/ViewMetadata.java>. > Which causes many duplicate codes just to use commonTable/View definitions > like Schema/MetadataLocation/Properties. > > At many places we have similar methods with overloaded parameters like > TableMetadata > <https://github.com/apache/iceberg/blob/b3273276fa4bac384b2429b7218fd18b242beefe/core/src/main/java/org/apache/iceberg/TableMetadata.java> > and ViewMetadata > <https://github.com/apache/iceberg/blob/b3273276fa4bac384b2429b7218fd18b242beefe/core/src/main/java/org/apache/iceberg/view/ViewMetadata.java>. > > > To support purge <https://github.com/apache/iceberg/issues/9433> on view > it is difficult to traverse to the historical metadata files. > > I would like to start a discussion on potential enhancement of > ViewMetadata > <https://github.com/apache/iceberg/blob/b3273276fa4bac384b2429b7218fd18b242beefe/core/src/main/java/org/apache/iceberg/view/ViewMetadata.java>. > > > 1. An abstract class such as *IcebergMetadata* with common definition > from TableMetadata > > <https://github.com/apache/iceberg/blob/b3273276fa4bac384b2429b7218fd18b242beefe/core/src/main/java/org/apache/iceberg/TableMetadata.java> > and ViewMetadata > > <https://github.com/apache/iceberg/blob/b3273276fa4bac384b2429b7218fd18b242beefe/core/src/main/java/org/apache/iceberg/view/ViewMetadata.java>. > > 2. Add something similar of MetadataLogEntry > > <https://github.com/apache/iceberg/blob/b3273276fa4bac384b2429b7218fd18b242beefe/core/src/main/java/org/apache/iceberg/TableMetadata.java#L195> > for ViewMetadata > > <https://github.com/apache/iceberg/blob/b3273276fa4bac384b2429b7218fd18b242beefe/core/src/main/java/org/apache/iceberg/view/ViewMetadata.java> > too. > > Please share your thoughts. > > Ref: https://github.com/apache/iceberg/pull/8907#discussion_r1441986754 > > Regards, > Naveen Kumar > >