ayushtkn commented on code in PR #4453:
URL: https://github.com/apache/hive/pull/4453#discussion_r1245473645
##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java:
##########
@@ -362,16 +362,33 @@ public StorageFormatDescriptor
getStorageFormatDescriptor(org.apache.hadoop.hive
return null;
}
- public boolean supportsAppendData(org.apache.hadoop.hive.metastore.api.Table
table) throws SemanticException {
+ public boolean supportsAppendData(org.apache.hadoop.hive.metastore.api.Table
table, boolean withPartClause)
+ throws SemanticException {
Table icebergTbl = IcebergTableUtil.getTable(conf, table);
- return icebergTbl.spec().isUnpartitioned();
+ if (icebergTbl.spec().isUnpartitioned()) {
+ return true;
+ }
+ // If it is a table which has undergone partition evolution, return false;
+ if (icebergTbl.currentSnapshot() != null) {
+ if
(icebergTbl.currentSnapshot().allManifests(icebergTbl.io()).parallelStream()
+ .map(ManifestFile::partitionSpecId)
+ .anyMatch(id -> id < icebergTbl.spec().specId())) {
+ if (withPartClause) {
+ throw new SemanticException("Can not Load into an iceberg table,
which has undergone partition evolution " +
+ "using the PARTITION clause");
+ }
+ return false;
+ }
+ }
+ return withPartClause || icebergTbl.spec().isUnpartitioned();
Review Comment:
done,copy-paste error
--
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]