2. Given $a, b \in \mathbf{R}$, satisfying $\sqrt{a^{2}+b^{2}}=a+b$. Then which of the following statements is correct? ( ).
(A) The equation never holds
(B) The equation holds if and only if $a b=0$
(C) The equation holds if and only if $a+b \geqslant 0$
(D) The equation holds if and only if $a b=0, a+b \geqslant 0$
(E) The equation always holds
2. D.

From $\sqrt{a^{2}+b^{2}}=a+b \geqslant 0$, squaring both sides gives
$$
\begin{array}{l}
a^{2}+b^{2}=(a+b)^{2}=a^{2}+2 a b+b^{2} \\
\Rightarrow a b=0,
\end{array}
$$

The equality holds if and only if $a+b \geqslant 0$ and $a b=0$.