KnightChess commented on a change in pull request #3459:
URL: https://github.com/apache/iceberg/pull/3459#discussion_r746218392



##########
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());
+      } else {
+        this.lazyPartitionSchema = new StructType();
+      }
+    }
+
+    return lazyPartitionSchema;
+  }
+
+  @Override
+  public void createPartition(InternalRow ident, Map<String, String> 
properties)
+      throws UnsupportedOperationException {
+    throw new UnsupportedOperationException("Cannot create partition: 
partitions exist only when there are rows");
+  }
+
+  @Override
+  public boolean dropPartition(InternalRow ident) {
+    throw new UnsupportedOperationException("Cannot drop partition: not 
implemented");
+  }
+
+  @Override
+  public void replacePartitionMetadata(InternalRow ident, Map<String, String> 
properties)
+      throws UnsupportedOperationException {
+    throw new UnsupportedOperationException("Cannot replace partition 
metadata: partition metadata is only related to" +
+        " data files");
+  }
+
+  @Override
+  public Map<String, String> loadPartitionMetadata(InternalRow ident) throws 
UnsupportedOperationException {
+    throw new UnsupportedOperationException("Cannot load partition metadata: 
not implemented");
+  }
+
+  @Override
+  public InternalRow[] listPartitionIdentifiers(String[] names, InternalRow 
ident) {
+    StructType partitionSchema = partitionSchema();
+    if (partitionSchema.isEmpty()) {

Review comment:
       > V1 Void Transforms strike again here, Let's make sure we are correctly 
returning "empty" from partitionSchema when we get those void's.
   
   I will test 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to