Sentience is a complex question, but it mostly revolves around language and symbol-making/recognition. There's substantial evidence that whales actually have language. Pigs and cattle do not.
(edit: I'm misusing the word "sentience" here. The problem is that it's not the right distinction. Cows/pigs are sentient, in that they can feel emotions. But they cannot reason. So it's not just that whales are sentient, but also that whales can reason. At any rate, whales are considered by most experts to be able to think similarly to the way humans think - language, symbolism.)