Skip to content

Commit

Permalink
Check for null items in the delete iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-celo committed Oct 16, 2023
1 parent 231dd64 commit bd7c59a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/scala/cognite/spark/v1/AssetHierarchyBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bd7c59a

Please sign in to comment.