How does lightning and metal rods make glass by sticking the rod in sand like in a beach?

like in the movie “sweet home alabama” when josh lucas made glass and stuck the metal rods and the sand on the beach.