[
https://issues.apache.org/jira/browse/HIVE-27234?focusedWorklogId=861044&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-861044
]
ASF GitHub Bot logged work on HIVE-27234:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 08/May/23 16:05
Start Date: 08/May/23 16:05
Worklog Time Spent: 10m
Work Description: deniskuzZ commented on code in PR #4216:
URL: https://github.com/apache/hive/pull/4216#discussion_r1187620978
##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java:
##########
@@ -676,6 +678,35 @@ public void
executeOperation(org.apache.hadoop.hive.ql.metadata.Table hmsTable,
}
}
+ @Override
+ public void createBranchOperation(org.apache.hadoop.hive.ql.metadata.Table
hmsTable,
+ AlterTableCreateBranchSpec createBranchSpec) {
+ TableDesc tableDesc = Utilities.getTableDesc(hmsTable);
+ Table icebergTable = IcebergTableUtil.getTable(conf,
tableDesc.getProperties());
+
+ String branchName = createBranchSpec.getBranchName();
+ Optional.ofNullable(icebergTable.currentSnapshot()).orElseThrow(() -> new
UnsupportedOperationException(
+ String.format("Cannot create branch %s on iceberg table %s.%s which
has no snapshot",
+ branchName, hmsTable.getDbName(), hmsTable.getTableName())));
+ Long snapshotId = Optional.ofNullable(createBranchSpec.getSnapshotId())
+ .orElse(icebergTable.currentSnapshot().snapshotId());
+ LOG.info("Creating branch {} on iceberg table {}.{}", branchName,
hmsTable.getDbName(),
+ hmsTable.getTableName());
+ ManageSnapshots manageSnapshots = icebergTable.manageSnapshots();
+ manageSnapshots.createBranch(branchName, snapshotId);
Review Comment:
👍
Issue Time Tracking
-------------------
Worklog Id: (was: 861044)
Time Spent: 7.5h (was: 7h 20m)
> Iceberg: CREATE BRANCH SQL implementation
> ------------------------------------------
>
> Key: HIVE-27234
> URL: https://issues.apache.org/jira/browse/HIVE-27234
> Project: Hive
> Issue Type: Sub-task
> Components: Iceberg integration
> Reporter: zhangbutao
> Assignee: zhangbutao
> Priority: Major
> Labels: pull-request-available
> Time Spent: 7.5h
> Remaining Estimate: 0h
>
> Maybe we can follow spark sql about branch ddl implementation
> [https://github.com/apache/iceberg/pull/6617]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)