zhangbutao commented on code in PR #7593:
URL: https://github.com/apache/iceberg/pull/7593#discussion_r1193097843
##########
spark/v3.4/spark-extensions/src/main/scala/org/apache/spark/sql/execution/datasources/v2/CreateOrReplaceBranchExec.scala:
##########
@@ -41,6 +41,9 @@ case class CreateOrReplaceBranchExec(
override protected def run(): Seq[InternalRow] = {
catalog.loadTable(ident) match {
case iceberg: SparkTable =>
+ if (iceberg.table.currentSnapshot() == null) {
+ throw new UnsupportedOperationException(s"The Iceberg table:
$iceberg" + " has no snapshots")
+ }
Review Comment:
@amogh-jahagirdar Thanks for detailed explanation! I might prefer to throw
`UnsupportedOperationException ` if user does not specify the snapshot and the
main latest snapshot is null.
But if you think it is more reasonable to pass null snapshotId to this API
https://github.com/apache/iceberg/blob/master/core/src/main/java/org/apache/iceberg/TableMetadata.java#L1181,
I'm happy to make further changes.
I have refined the PR. Please take a look again if you have a chance.
--
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]