I am getting 502 error while trying to delete topics created by specific user

No, it doesn’t hide the posts; it removes the username. It’s a good solution at times when the user asks to have his account deleted, because it preserves the content, keeping the topics in your community intact, while making that content anonymous, so no one knows who wrote it. It is described fully, here:

If you have a hosted site, it might be best to let the Discourse team assist.