xtern commented on code in PR #3058: URL: https://github.com/apache/ignite-3/pull/3058#discussion_r1469143977
########## modules/catalog/src/main/java/org/apache/ignite/internal/catalog/descriptors/CatalogTableDescriptor.java: ########## @@ -219,4 +221,53 @@ public void updateToken(long updateToken) { this.creationToken = this.creationToken == INITIAL_CAUSALITY_TOKEN ? updateToken : this.creationToken; } + + /** + * Serializer for {@link CatalogTableDescriptor}. + */ + private static class TableDescriptorSerializer implements CatalogObjectSerializer<CatalogTableDescriptor> { + @Override + public CatalogTableDescriptor readFrom(int version, IgniteDataInput input) throws IOException { + CatalogDescriptorBase header = CatalogObjectDescriptor.SERIALIZER.readFrom(version, input); + CatalogTableSchemaVersions schemaVersions = CatalogTableSchemaVersions.SERIALIZER.readFrom(version, input); + List<CatalogTableColumnDescriptor> columns = readList(version, CatalogTableColumnDescriptor.SERIALIZER, input); + + int schemaId = input.readInt(); + int pkIndexId = input.readInt(); + int zoneId = input.readInt(); + + List<String> primaryKeyColumns = readStringList(input); + List<String> colocationColumns = readStringList(input); + + long creationToken = input.readLong(); + + return new CatalogTableDescriptor( + header.id(), + schemaId, + pkIndexId, + header.name(), + zoneId, + columns, + primaryKeyColumns, + colocationColumns, + schemaVersions, + header.updateToken(), + creationToken + ); + } + + @Override + public void writeTo(CatalogTableDescriptor descriptor, int version, IgniteDataOutput output) throws IOException { + CatalogObjectDescriptor.SERIALIZER.writeTo(new CatalogDescriptorBase(descriptor), version, output); + CatalogTableSchemaVersions.SERIALIZER.writeTo(descriptor.schemaVersions(), version, output); + writeList(descriptor.columns(), version, CatalogTableColumnDescriptor.SERIALIZER, output); + + output.writeInt(descriptor.schemaId()); + output.writeInt(descriptor.primaryKeyIndexId()); + output.writeInt(descriptor.zoneId()); + writeStringCollection(descriptor.primaryKeyColumns(), output); + writeStringCollection(descriptor.colocationColumns(), output); Review Comment: I'm not sure it's worth adding such optimization. As I understand we need to compare collections for equality here + store special marker (for example size = `-2`) that collection are equal. :thinking: -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org