@@ -16,14 +16,37 @@ import KindPredicatesLog
1616float getBadness ( ComputeSimple simple ) {
1717 exists ( float maxTupleCount , float resultSize , float largestDependency , float denom |
1818 resultSize = simple .getResultSize ( ) and
19- maxTupleCount = max ( simple . getPipelineRun ( ) . getCount ( _ ) ) and
19+ extractInformation ( simple , maxTupleCount , _ , _ , _ ) and
2020 largestDependency = max ( simple .getDependencies ( ) .getADependency ( ) .getResultSize ( ) ) and
2121 denom = resultSize .maximum ( largestDependency ) and
2222 denom > 0 and // avoid division by zero (which would create a NaN result).
2323 result = maxTupleCount / denom
2424 )
2525}
2626
27- from ComputeSimple evt , float f
28- where f = getBadness ( evt ) and f > 1.5
29- select evt , f order by f desc
27+ pragma [ nomagic]
28+ predicate hasPipelineRun ( ComputeSimple simple , PipeLineRun run ) { run = simple .getPipelineRun ( ) }
29+
30+ predicate extractInformation (
31+ ComputeSimple simple , float maxTupleCount , Array tuples , Array duplicationPercentages , Array ra
32+ ) {
33+ exists ( PipeLineRun run |
34+ hasPipelineRun ( simple , run ) and
35+ maxTupleCount = max ( run .getCount ( _) ) and
36+ tuples = run .getCounts ( ) and
37+ duplicationPercentages = run .getDuplicationPercentage ( ) and
38+ ra = simple .getRA ( )
39+ )
40+ }
41+
42+ from
43+ ComputeSimple evt , float badness , float maxTupleCount , Array tuples , Array duplicationPercentages ,
44+ Array ra , int index
45+ where
46+ badness = getBadness ( evt ) and
47+ badness > 1.5 and
48+ extractInformation ( evt , maxTupleCount , tuples , duplicationPercentages , ra )
49+ select evt .getPredicateName ( ) as predicate_name , badness , index ,
50+ tuples .getFloat ( index ) as tuple_count ,
51+ duplicationPercentages .getFloat ( index ) as duplication_percentage , ra .getString ( index ) order by
52+ badness desc
0 commit comments