felixYyu commented on issue #3558:
URL: https://github.com/apache/iceberg/issues/3558#issuecomment-985997089
I try to edit SparkTable implements SupportsPartitionManagement
`@Override
public StructType partitionSchema() {
return (StructType)
SparkSchemaUtil.convert(icebergTable.spec().partitionType());
}
@Override
public void createPartition(InternalRow ident, Map<String, String>
properties)
throws PartitionAlreadyExistsException,
UnsupportedOperationException {
if(partitionExists(ident)){
throw new PartitionAlreadyExistsException(name(), ident, schema());
}
else{
icebergTable.updateSpec()
.addField((Term) ident.toSeq(partitionSchema()))
.commit();
}
}
@Override
public boolean dropPartition(InternalRow ident) {
try{
if (partitionExists(ident)){
icebergTable.updateSpec()
.removeField(ident.toSeq(partitionSchema()).mkString())//
term
.commit();
return true;
}
}catch (IllegalArgumentException e) {
LOG.info("no partition exists for the identifier");
}
return false;
}
@Override
public void replacePartitionMetadata(InternalRow ident, Map<String,
String> properties) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Iceberg partitions do not
support metadata");
}
@Override
public Map<String, String> loadPartitionMetadata(InternalRow ident) throws
UnsupportedOperationException {
throw new UnsupportedOperationException("Iceberg partitions do not
support metadata");
}
@Override
public InternalRow[] listPartitionIdentifiers(String[] names, InternalRow
ident) {
return new InternalRow[0];
}`
--
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]