You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/12/04 09:20:43 UTC
[GitHub] [iceberg] felixYyu commented on issue #3558: Spark: Support alter partition in V2 Catalog SparkCatalog Class
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org