和子类别表:
我希望将 EventsTable 中的所有行标记为“dataflow”子类别,因为关键字:cpu、dataflow 和 cpupct 属于子类别数据流。
我正在寻找具有如下逻辑的查询:
let Subcategory = datatable(subcategory:string, keywords:dynamic )
[
'saturacion', dynamic(["saturation","infrastructure"]),
'slow disk',dynamic(["low","disk","space"]),
'saturacion',dynamic(["using","win","use"]),
'saturacion',dynamic(["used","win","utilization","percentage"]),
'swap memory',dynamic(["swap","memory","usage"]),
'disk full',dynamic(["disk","free","size","filesystemspace"]),
'dataflow',dynamic(["cpu","dataflow","cpupct"])
];
let EventsTable = datatable(ID:string, category:string, words:dynamic )
[
'mcsc1','cpu',dynamic(["swap","memory","usage"]),
'mcsc2','cpu',dynamic(["disk","free","size","filesystemspace"]),
'mcsc3','cpu',dynamic(["cpu","dataflow","cpupct"])
];
EventsTable
| mv-apply Subcategory on
(
extend subcat=iff(
array_length(set_intersect(words, Subcategory.keywords)) == array_length(Subcategory.keywords),
Subcategory.subcategory, 'none')
)