I know I should do some substitution and then somehow use $\text{sign}(\cdot)$ function to solve this, but I have no idea. My problem is the $\text{sign}(\cdot)$ function. I found this answer Differential equation, a square root and substitution, but I don't know how he extracted $\text{sign}(\cdot)$ under the square root.
$$x y' - y = \sqrt{x^2+y^2}$$
Following the similar path the link takes, let $w=\frac{y}{x}$. Then \begin{align} wx &= y \\ \implies xw'+w &= y' \end{align} hence your ODE becomes \begin{align} x(w+xw') - wx &= \sqrt{x^2\left(1+w^2\right)} \\ \implies x^2 w' &= \operatorname{sgn}(x)\sqrt{1+w^2} \end{align} Where the Signum funciton is defined as $$\operatorname{sgn}(x) := \begin{cases} -1 & \text{if } x < 0, \\ 0 & \text{if } x = 0, \\ 1 & \text{if } x > 0. \end{cases}$$