very similar to a typical welding process wrt to where the heat comes from. electricity, though it's contact resistance here instead of an arc. www.thefabricator.com/article/tubepipefabrication/comparing-flash-and-butt-welding
High current is flowing through the electrodes which is restricted by resistance of the material which is to be weld. as this resistance that offered in the path of current gernerates heat.