I have a id and role mapping in below format
{
"ra": [
{
"id": 168,
"code": "AFAP"
},
{
"id": 180,
"code": "ABC"
},
{
"id": 180,
"code": "ABCMND"
}
]
}
I need the output to be like below
{
"roleactions": {
"168": [
"AFAP"
],
"180": [
"ABC",
"ABCMND",
"DCRMP"
]
}
}
So i wrote the below code
roleactions = r_map {
r := data.ra
r_map := {id: list |
some i
id := r[i].id
list := [obj |
some j
r[j].id == id
obj := r[j].code
]
}
}
But when I run this for it almost takes 5-6 seconds
Found 1 result in 5682526.465 μs.
Can someone guide on how to make write this policy map to improve performance?
question from:
https://stackoverflow.com/questions/66052212/open-policy-agent-improve-performance-of-a-grouping-comprehension 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…