我想在我只需要将一个输入映射到输出的地方制造一些震动。
感谢任何帮助或建议。
如果 topicA.owner 和 topicZ.owner 都存在输出 owner.name 应映射到 topicZ.owner>
如果 topicA.owner 仅输出 owner.name 应该映射到 topicA.owner
如果 topicZ.owner 仅输出 owner.name 应该映射到 topicZ.owner
输入:
CREATE INDEX performance_idx ON daily_factors (factor_date);
震动:
{
"topicA": {
"owner": "topic_a_owner"
},
"topicZ": {
"owner": "topic_z_owner"
}
}
预期输出:
[
{
"spec": {
"*": {
"ta": "@(2,topicA.owner)",
"za": "@(2,topicZ.owner)"
}
},
"operation": "modify-default-beta"
},
{
"operation": "shift",
"spec": {
"topicA": {
"ta": "owner.name"
},
"topicZ": {
"za": "owner.name"
}
}
}
]
答案 0 :(得分:0)
您提到的3个条件可以简化为以下2个条件。
所以在此基础上,可以进行以下操作。
modify-default-beta
操作将 topicA.owner
的值复制到 topicZ.owner
字段当 topicZ.owner
不存在时。shift
操作将 topicZ.owner
的值映射到输出中的 owner.name
字段。[
{
"spec": {
"topicZ": {
"owner": "@(2,topicA.owner)"
}
},
"operation": "modify-default-beta"
},
{
"operation": "shift",
"spec": {
"topicZ": {
"owner": "owner.name"
}
}
}
]