You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Tamas Mate (Jira)" <ji...@apache.org> on 2022/03/24 12:53:00 UTC

[jira] [Created] (IMPALA-11199) Use UpdatePartitionSpec API to alter Iceberg partition specs

Tamas Mate created IMPALA-11199:
-----------------------------------

             Summary: Use UpdatePartitionSpec API to alter Iceberg partition specs
                 Key: IMPALA-11199
                 URL: https://issues.apache.org/jira/browse/IMPALA-11199
             Project: IMPALA
          Issue Type: Improvement
          Components: Frontend
    Affects Versions: Impala 4.1.0
            Reporter: Tamas Mate


Impala uses the iceberg TableMetadata object dugin [alterTableSetPartitionSpec |https://github.com/apache/impala/blob/master/fe/src/main/java/org/apache/impala/service/IcebergCatalogOpExecutor.java#L166]. This class is part of the core package which ideally should not be accessed by external applications:
{code:java}
BaseTable iceTable = (BaseTable)IcebergUtil.loadTable(feTable);
TableOperations tableOp = iceTable.operations();
TableMetadata metadata = tableOp.current();

Schema schema = metadata.schema();
PartitionSpec newPartSpec = IcebergUtil.createIcebergPartition(schema, partSpec);
TableMetadata newMetadata = metadata.updatePartitionSpec(newPartSpec);
Map<String, String> properties = new HashMap<>(newMetadata.properties());
{code}

Iceberg has an [UpdatePartitionSpec|https://github.com/apache/iceberg/blob/master/api/src/main/java/org/apache/iceberg/UpdatePartitionSpec.java#L32] api, which should be used in these situations if possible.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)