This is an exercise problem in Conway functional analysis book, Chapter 1 section 6.
Let $\{(X_i,\Omega_i, \mu_i): i\in I\}$ be a collection of measure spaces. Define $X, \Omega$ and $\mu$ as follows. Let $X$= the disjoint union of $\{X_i:i\in I\}$ and $\Omega=\{\Delta\subset X: \Delta\cap X_i\in \Omega_i $for all $i \}$. For $\Delta$ in $\Omega$ put $\mu(\Delta)=\sum_{i}\mu_i(\Delta\cap X_i)$. Show that $(X,\Omega, \mu)$ is a measure space and $L^2(X,\Omega,\mu)$ is isomorphic to $\bigoplus\{L^2(X_i,\Omega_i,\mu_i): i\in I\} $.
Can you tell ne what function would give the isomorphism?
Map $f \in L^{2}(X, \Omega,\mu)$ to $\bigoplus f_i$ where $f_i$ is the restriction of $f$ to $X_i$.