I am unclear on the roles of Catalyst optimizer and Project Tungsten.
My understanding is that Catalyst optimizer will produce optimized Physical plan from logical plan. The optimized physical plan will then taken by Code generator to emit Rdd's.
Is the Code generator part of Project Tungsten or Catalyst Optimizer? And is the Code generator also called "Whole Stage Code generator"?
A look into the Glossar from Databricks or other online resources should clarify your doubts:
Tungsten
Catalyst Optimizer
The Catalyst optimizer takes your code and converts it into an execution plan which finally ends up in generating compact code for the JVM. It goes through four transformational phases depicted in the picture below:
Note, that the "Code Generation" phase is the fourth phase in the Catalyst Optimizer. More details in the subsequent seciont.
WholeStage Code Generator