Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 删除模型时没有删除s2_model_rela表中模型的关联关系,导致指标探索时出现空指针异常 #1370

Open
2 of 3 tasks
liiux opened this issue Jul 8, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@liiux
Copy link

liiux commented Jul 8, 2024

Search before asking

  • I had searched in the issues and found no similar issues.

Version

commit id:fa5abc58a55e3971ff083a5496a0006b1cb51ae0

What's Wrong?

删除模型时没有删除s2_model_rela表中模型的关联关系,导致指标探索时出现空指针异常

private static void dfs(ModelSchemaResp model, Map<Long, ModelSchemaResp> modelMap,
            Set<Long> visited, Set<Long> modelCluster) {
        visited.add(model.getId()); // model is null
        modelCluster.add(model.getId());
        for (Long neighborId : model.getModelClusterSet()) {
            if (!visited.contains(neighborId)) {
                dfs(modelMap.get(neighborId), modelMap, visited, modelCluster);
            }
        }
    }

应该还有其他地方也会有类似的异常

What You Expected?

删除模型时应同步删除s2_model_rela表中模型的关联关系,并且应该添加判空处理

private static void dfs(ModelSchemaResp model, Map<Long, ModelSchemaResp> modelMap,
            Set<Long> visited, Set<Long> modelCluster) {
        visited.add(model.getId());
        modelCluster.add(model.getId());
        for (Long neighborId : model.getModelClusterSet()) {
            if (!visited.contains(neighborId) && modelMap.containsKey(neighborId)) {
                dfs(modelMap.get(neighborId), modelMap, visited, modelCluster);
            }
        }
    }

How to Reproduce?

No response

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@liiux liiux added the bug Something isn't working label Jul 8, 2024
@lxwcodemonkey
Copy link
Collaborator

有兴趣提交一个PR吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants