@@ -82,11 +82,10 @@ predicate hasDuplication(ComputeRecursive recursive, string ordering, int i, flo
82
82
)
83
83
}
84
84
85
- // -----
86
85
/**
87
- * Holds if the bucket `bucket ` has `resultSize` resultSize in the `iteration`'th iteration.
86
+ * Holds if the ordering `ordering ` has `resultSize` resultSize in the `iteration`'th iteration.
88
87
*
89
- * For example, the "base" bucket in iteration 0 has size 42.
88
+ * For example, the "base" ordering in iteration 0 has size 42.
90
89
*/
91
90
private predicate hasResultSize (
92
91
ComputeRecursive recursive , string ordering , SummaryEvent inLayer , int iteration , float resultSize
@@ -130,9 +129,9 @@ int getSize(ComputeRecursive recursive, string predicateName, int iteration, TDe
130
129
kind = TCurrent ( ) and
131
130
i = iteration
132
131
|
133
- result = getInLayerEventWithName ( recursive , predicateName ) .getDeltaSize ( iteration - 1 )
132
+ result = getInLayerEventWithName ( recursive , predicateName ) .getDeltaSize ( i )
134
133
or
135
- not exists ( getInLayerEventWithName ( recursive , predicateName ) .getDeltaSize ( iteration - 1 ) ) and
134
+ not exists ( getInLayerEventWithName ( recursive , predicateName ) .getDeltaSize ( i ) ) and
136
135
result = 0
137
136
)
138
137
}
@@ -155,35 +154,35 @@ private predicate isDelta(string predicateName, TDeltaKind kind, string withoutS
155
154
withoutSuffix = predicateName .regexpCapture ( "(.+)#cur_delta" , 1 )
156
155
}
157
156
158
- predicate hasDependentPredicateSizeInBucket (
159
- ComputeRecursive recursive , string bucket , SummaryEvent inLayer , int iteration ,
157
+ predicate hasDependentPredicateSize (
158
+ ComputeRecursive recursive , string ordering , SummaryEvent inLayer , int iteration ,
160
159
string predicateName , float size
161
160
) {
162
161
exists ( |
163
162
inLayer = firstPredicate ( recursive ) and
164
- bucket = inLayer .getPipelineRuns ( ) .getRun ( iteration ) .getRAReference ( )
163
+ ordering = inLayer .getPipelineRuns ( ) .getRun ( iteration ) .getRAReference ( )
165
164
|
166
165
// We treat iteration 0 as a non-recursive case
167
- if bucket = "base"
166
+ if ordering = "base"
168
167
then size = getDependencyWithName ( recursive .getDependencies ( ) , predicateName ) .getResultSize ( )
169
168
else
170
169
exists ( TDeltaKind kind |
171
170
size = getSize ( recursive , predicateName , iteration , kind ) and
172
- isDelta ( getAnRaOperation ( inLayer , bucket ) .getARhsPredicate ( ) , kind , predicateName )
171
+ isDelta ( getAnRaOperation ( inLayer , ordering ) .getARhsPredicate ( ) , kind , predicateName )
173
172
)
174
173
)
175
174
or
176
175
exists ( SummaryEvent inLayer0 , float size0 |
177
176
successor ( recursive , inLayer0 , inLayer ) and
178
- hasDependentPredicateSizeInBucket ( recursive , bucket , inLayer0 , iteration , predicateName , size0 )
177
+ hasDependentPredicateSize ( recursive , ordering , inLayer0 , iteration , predicateName , size0 )
179
178
|
180
179
// We treat iteration 0 as a non-recursive case
181
- if bucket = "base"
180
+ if ordering = "base"
182
181
then size = getDependencyWithName ( recursive .getDependencies ( ) , predicateName ) .getResultSize ( )
183
182
else
184
183
exists ( TDeltaKind kind |
185
184
size = getSize ( recursive , predicateName , iteration , kind ) + size0 and
186
- isDelta ( getAnRaOperation ( inLayer , bucket ) .getARhsPredicate ( ) , kind , predicateName )
185
+ isDelta ( getAnRaOperation ( inLayer , ordering ) .getARhsPredicate ( ) , kind , predicateName )
187
186
)
188
187
)
189
188
}
@@ -192,13 +191,13 @@ SummaryEvent getInLayerOrRecursive(ComputeRecursive recursive) {
192
191
result = recursive or result .( InLayer ) .getComputeRecursiveEvent ( ) = recursive
193
192
}
194
193
195
- predicate hasDependentPredicateSizeInBucket (
196
- ComputeRecursive recursive , string bucket , string predicateName , float size
194
+ predicate hasDependentPredicateSize (
195
+ ComputeRecursive recursive , string ordering , string predicateName , float size
197
196
) {
198
197
size =
199
198
strictsum ( SummaryEvent inLayer , int iteration , int s |
200
199
inLayer = getInLayerOrRecursive ( recursive ) and
201
- hasDependentPredicateSizeInBucket ( recursive , bucket , inLayer , iteration , predicateName , s )
200
+ hasDependentPredicateSize ( recursive , ordering , inLayer , iteration , predicateName , s )
202
201
|
203
202
s
204
203
)
@@ -216,12 +215,12 @@ predicate hasDependentPredicateSizeInBucket(
216
215
* - For a non-"base" ordering, it's defined as any `#prev_delta` or `#cur_delta` predicates
217
216
* that appear in the pipeline.
218
217
*/
219
- float getRecursiveBadness ( ComputeRecursive recursive , string bucket ) {
218
+ float getRecursiveBadness ( ComputeRecursive recursive , string ordering ) {
220
219
exists ( float maxTupleCount , float resultSize , float maxDependentPredicateSize |
221
- maxTupleCount = max ( float tc | hasTupleCount ( recursive , bucket , _, tc ) | tc ) and
222
- hasResultSize ( recursive , bucket , resultSize ) and
220
+ maxTupleCount = max ( float tc | hasTupleCount ( recursive , ordering , _, tc ) | tc ) and
221
+ hasResultSize ( recursive , ordering , resultSize ) and
223
222
maxDependentPredicateSize =
224
- max ( float size | hasDependentPredicateSizeInBucket ( recursive , bucket , _, size ) | size ) and
223
+ max ( float size | hasDependentPredicateSize ( recursive , ordering , _, size ) | size ) and
225
224
resultSize .maximum ( maxDependentPredicateSize ) > 0 and
226
225
result = maxTupleCount / resultSize .maximum ( maxDependentPredicateSize )
227
226
)
@@ -259,9 +258,9 @@ where
259
258
badness = getNonRecursiveBadness ( evt ) and
260
259
extractSimpleInformation ( evt , predicateName , index , tupleCount , duplicationPercentage , operation )
261
260
or
262
- exists ( string bucket |
263
- badness = getRecursiveBadness ( evt , bucket ) and
264
- extractRecursiveInformation ( evt , predicateName , bucket , index , tupleCount ,
261
+ exists ( string ordering |
262
+ badness = getRecursiveBadness ( evt , ordering ) and
263
+ extractRecursiveInformation ( evt , predicateName , ordering , index , tupleCount ,
265
264
duplicationPercentage , operation )
266
265
)
267
266
)
0 commit comments