Solution (source code)

= Solution

Assume $0\leq a<R$. In <cylindrical coordinates>, the sphere imposes $r^2+z^2\leq R^2$, and the volume element is $r\,dr\,d\phi\,dz$. The required <triple integral> is
$$
V=\int_{-a}^a\int_0^{2\pi}\int_0^{\sqrt{R^2-z^2}}r\,dr\,d\phi\,dz=\pi\int_{-a}^a(R^2-z^2)\,dz.
$$
Hence
$$
\boxed{V=2\pi a\left(R^2-\frac{a^2}{3}\right).}
$$
It tends to zero as $a\to0$ and to the full sphere volume $4\pi R^3/3$ as $a\to R$, checking both limits.