TITLE: What is known about Ulam's problem of metric spaces with isometric squares?
QUESTION [15 upvotes]: Background
In the book Problems in Modern Mathematics, S. Ulam asks the following question:
Suppose $A$ and $B$ are metric spaces, such that $A^2$ and $B^2$ equipped with the 2-metric $d((x_1, y_1),(x_2, y_2)) = \sqrt{d(x_1, x_2)^2 + d(y_1, y_2)^2}$ are isometric. Does it follow that $A$ and $B$ must also be isometric themselves?
The answer to this general question is negative. Take for example the space of the rational numbers $\mathbb{Q}$ and the space $\mathbb{Q} \sqrt{2}$ of rational multiples of $\sqrt{2}$. These two spaces are obviously not isometric, but their squares are, isometry being just the rotation by $\frac{\pi}{4}$. See http://www.ams.org/journals/proc/1971-029-03/S0002-9939-1971-0278262-5/S0002-9939-1971-0278262-5.pdf for the proof.
Question
What is the status of this problem for slightly less general metric spaces? I am especially interested in the following cases:

What is known about this problem for complete metric spaces?
What is known for finite metric spaces?

A good survey if it exists would be more than welcome.

REPLY [7 votes]: This is known for geodesic metric spaces of finite affine dimension by a beautiful result of Alexander Lytchak and Thomas Foertsch. The de Rham decomposition theorem for metric spaces.
Geom. Funct. Anal., Vol. 18 (2008), 120-143 
Here a metric space is called affine if it is isometric to a  convex subset of a normed vector space. Given a metric space $X$ its affine rank, $rank_{aff}(X)$ is defined as the supremum over all topological dimensions of affine spaces that admit an isometric embedding into $X$. Note that $rank_{aff}(X)$  is bounded above by the topological dimension of $X$.
Lytchak and  Foertsch proved that a geodesic metric space of finite affine dimension can be uniquely written as a product $X=Y_0\times Y_1\times\ldots\times Y_k$ where $Y_0$ is a Euclidean space (possibly a point) and $Y_i$ are irreducible (i.e. can not be written as products) and different from $\mathbb R$ or a point. This of course implies the result you are asking about.