KnightChess commented on a change in pull request #3459: URL: https://github.com/apache/iceberg/pull/3459#discussion_r746201352
########## File path: spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/source/SparkTable.java ########## @@ -298,6 +311,103 @@ public void deleteWhere(Filter[] filters) { } } + @Override + public StructType partitionSchema() { + if (lazyPartitionSchema == null) { + Table table = table(); + PartitionsTable partitionsTable = + (PartitionsTable) MetadataTableUtils.createMetadataTableInstance(table, MetadataTableType.PARTITIONS); + Types.NestedField partition = partitionsTable.schema().findField("partition"); + if (partition != null) { + this.lazyPartitionSchema = (StructType) SparkSchemaUtil.convert(partition.type()); Review comment: > V1 Tables which have had a partition field removed leave this as a field in their spec that is mean this is not suitable for use Types.NestedField. I am not sure if Igot it. Is there a related detailed doc? I don't know if there are other ways to get partitions when use partition metadata table. I can use sparkTable.spec to instead it. -- 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