**[Mercury](http://en.wikipedia.org/wiki/Mercury_%28planet%29) vs. the [Sun](http://en.wikipedia.org/wiki/Sun)**

 - **Mass:** Mercury - $3.3022×10^{23} \text{ kg}$; Sun - $1.98855×10^{30} \text{ kg}$. Mercury clearly won't so much as jostle the Sun. There should be no major changes in the Sun's orbit around the galactic center.
 - **Composition:** Mercury - oxygen, sodium and hydrogen; Sun - hydrogen and helium. The extra elements shouldn't affect the Sun's fusion process, especially given how scarce they are.

**[Jupiter](http://en.wikipedia.org/wiki/Jupiter) vs. the Sun**

 - **Mass:** Jupiter - $1.8986×10^{27} \text{ kg}$; Sun - $1.98855×10^{30} \text{ kg}$. Jupiter could perhaps perturb the Sun a little if it hit it right on.

 - **Composition:** Jupiter - hydrogen and helium; Sun - hydrogen and helium. The Sun would gain a little fuel, but not enough to cause a substantial change in the Sun's fusion.

In both cases, the Earth should be fine. Sure, there could be a solar flare or two, but not anything substantial enough to severely impact the Earth.

There are two interesting side effects of such a collision, and while they wouldn't impact Earth, they're still worthy of mention. First, the collision of a gas giant with a star would increase the lithium-6 concentration in the star (see [this article](http://physicsworld.com/cws/article/news/2001/may/09/cannibal-star-ate-planet) about [HD 82943](https://en.wikipedia.org/wiki/HD_82943)). Second, if the planet (again, assuming it's a gas giant) was a victim of orbital decay, then it could be torn apart when it reached the [Roche limit](https://en.wikipedia.org/wiki/Roche_limit). The resulting angular momentum transfer could drastically increase the star's rotation rate (see [Hellier et al. (2009)](http://orbi.ulg.ac.be/bitstream/2268/28276/1/nature08245.pdf)).