Yes, you have to rewrite your program to make it work over a cluster (distributed computing). Hadoop is a framework that makes the rewriting easier.
In my book, I gave an example of writing a
word counting program. Writing such a program to run on a single machine is easy. Writing it to run on a cluster of machines introduces a lot of complexity. The Hadoop framework eliminates much of that complexity, but the program will have to be architected differently.