diff --git a/src/main/scala/cognite/spark/v1/AssetHierarchyBuilder.scala b/src/main/scala/cognite/spark/v1/AssetHierarchyBuilder.scala index d7b35333f..2684a1148 100644 --- a/src/main/scala/cognite/spark/v1/AssetHierarchyBuilder.scala +++ b/src/main/scala/cognite/spark/v1/AssetHierarchyBuilder.scala @@ -80,7 +80,9 @@ class AssetHierarchyBuilder(config: RelationConfig)(val sqlContext: SQLContext) def delete(data: DataFrame): Unit = data.foreachPartition((rows: Iterator[Row]) => { - val deletes = rows.map(r => fromRow[DeleteItemByCogniteId](r)) + val deletes = rows + .map(fromRow[DeleteItemByCogniteId](_)) + .filter(_ != null) Stream .fromIterator[IO](deletes, chunkSize = batchSize) .chunks