refactor: merge codegen and mapreduce