@@ -8,7 +8,7 @@ import ldbc.snb.datagen.util.Logging
8
8
import org .apache .spark .sql .{Column , DataFrame }
9
9
import org .apache .spark .sql .functions ._
10
10
11
- case class RawToBiTransform (mode : BI , simulationStart : Long , simulationEnd : Long ) extends Transform [Mode .Raw .type , Mode .BI ] with Logging {
11
+ case class RawToBiTransform (mode : BI , simulationStart : Long , simulationEnd : Long , keepImplicitDeletes : Boolean ) extends Transform [Mode .Raw .type , Mode .BI ] with Logging {
12
12
log.debug(s " BI Transformation parameters: $mode" )
13
13
14
14
val bulkLoadThreshold = Interactive .calculateBulkLoadThreshold(mode.bulkloadPortion, simulationStart, simulationEnd)
@@ -52,7 +52,7 @@ case class RawToBiTransform(mode: BI, simulationStart: Long, simulationEnd: Long
52
52
val idColumns = tpe.primaryKey.map(qcol)
53
53
df
54
54
.filter(inBatch($" deletionDate" , batchStart, batchEnd))
55
- .filter(if (df.columns.contains(" explicitlyDeleted" )) col(" explicitlyDeleted" ) else lit(false ))
55
+ .filter(if (df.columns.contains(" explicitlyDeleted" )) col(" explicitlyDeleted" ) else lit(true ))
56
56
.pipe(batched)
57
57
.select(Seq ($" delete_batch_id" .as(" batch_id" ), $" deletionDate" ) ++ idColumns : _* )
58
58
.repartitionByRange($" batch_id" )
@@ -65,7 +65,10 @@ case class RawToBiTransform(mode: BI, simulationStart: Long, simulationEnd: Long
65
65
tpe -> BatchedEntity (
66
66
Interactive .snapshotPart(tpe, v, bulkLoadThreshold, filterDeletion = false ),
67
67
Some (Batched (insertBatchPart(tpe, v, bulkLoadThreshold, simulationEnd), Seq (" batch_id" ))),
68
- Some (Batched (deleteBatchPart(tpe, v, bulkLoadThreshold, simulationEnd), Seq (" batch_id" )))
68
+ if (keepImplicitDeletes || v.columns.contains(" explicitlyDeleted" ))
69
+ Some (Batched (deleteBatchPart(tpe, v, bulkLoadThreshold, simulationEnd), Seq (" batch_id" )))
70
+ else
71
+ None
69
72
)
70
73
}
71
74
Graph [Mode .BI , DataFrame ](isAttrExploded = input.isAttrExploded, isEdgesExploded = input.isEdgesExploded, mode, entities)
0 commit comments