diff --git a/spark/src/main/scala/org/apache/spark/sql/delta/storage/dv/DeletionVectorStore.scala b/spark/src/main/scala/org/apache/spark/sql/delta/storage/dv/DeletionVectorStore.scala index 51f472472c7..0f40a9dff01 100644 --- a/spark/src/main/scala/org/apache/spark/sql/delta/storage/dv/DeletionVectorStore.scala +++ b/spark/src/main/scala/org/apache/spark/sql/delta/storage/dv/DeletionVectorStore.scala @@ -223,13 +223,16 @@ class HadoopFileSystemDVStore(hadoopConf: Configuration) checksum = DeletionVectorStore.calculateChecksum(data)) if (writtenBytes != dvRange.offset) { - recordDeltaEvent( - deltaLog = null, - opType = "delta.deletionVector.write.offsetMismatch", + deltaAssert( + writtenBytes == dvRange.offset, + name = "dv.write.offsetMismatch", + msg = s"Offset mismatch while writing deletion vector to file", data = Map( "path" -> path.path.toString, "reportedOffset" -> dvRange.offset, - "calculatedOffset" -> writtenBytes)) + "calculatedOffset" -> writtenBytes) + ) + throw DeltaErrors.deletionVectorSizeMismatch() } log.debug(s"Writing DV range to file: Path=${path.path}, Range=${dvRange}")