我想在 EPL 查询中为不同用户设置查看权限,如下所示:
Users AllowedView
U1 V1,V2
U2 V1,V3
U3 V2,V3
Input Events sequence are as:
User View Amount
1. U1, V1, 20
2. U2, V3, 30
3. U3, V3, 40
4. U3, V2, 50
Output required as Sum(amount):
1. U1 - 20, U2 - 20 (as V1 is changed and permission to U1 & U2)
2. U2 - 50, U3 - 30 (as V3 is changed and permission to U2 & U3)
3. U2 - 90, U3 - 70 (as V3 is changed and permission to U2 & U3)
4. U1 - 70, U3 - 100 (as V2 is changed and permission to U1 & U3)
我认为上下文会做到这一点,但需要一些帮助来简化事件流和配置上下文。
所以我需要在视图组的基础上创建上下文分区。如
Partition1 - V1,V2
Partition2 - V1,V3
Partition3 - V2,V3
这样所有的计算都可以在它们的基础上进行。如您所见,上下文的分区键不是单属性或双属性,它基本上是一组相同的属性。所以我不能写成
Create context TestContext
partition by view
from EventPermissibleView;