Skip to content

Commit 69e3ec8

Browse files
Differential Privacy Teamcopybara-github
authored andcommitted
Solve the data race problem.
PiperOrigin-RevId: 905103948
1 parent 44e4d49 commit 69e3ec8

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

pipelinedp4j/main/com/google/privacy/differentialprivacy/pipelinedp4j/api/QueryPerGroupResult.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,15 @@ internal constructor(
6161
outputColumnNamesWithMetricTypes,
6262
colNameToFeatureIdMap,
6363
)
64-
return QueryPerGroupResult<GroupKeysT>(groupKey, valueAggregationsMap, vectorAggregationsMap)
64+
65+
val finalValueMap = LinkedHashMap(valueAggregationsMap)
66+
val finalVectorMap = LinkedHashMap(vectorAggregationsMap)
67+
68+
// Eagerly access entries to avoid lazy initialization race
69+
val unusedValueEntries = finalValueMap.entries
70+
val unusedVectorEntries = finalVectorMap.entries
71+
72+
return QueryPerGroupResult<GroupKeysT>(groupKey, finalValueMap, finalVectorMap)
6573
}
6674

6775
internal fun valueColumnsNamesInAggregationResults(

0 commit comments

Comments
 (0)