Student or Learner
When you hear someone suggest an unrealistic solution to a problem, do you say, "That sounds like a castle in the sand" or "It's a painting in the sky"?
I've heard a Japanese economist use these idioms in an interview session on TV. However, I have never heard them used in real English communication ,and they are not in my dictionaries.
Do you think they are popular expressions?
Then the foolish man built his house on sand
This comes from the Bible - in a parable from the Gospel of St Matthew, and means that the basis of something is uncertain. Your source has the sayings slightly confused - the other saying is "Castles in the air" - impossible dreams.