This is not highly optimized, I may need to fix the generateOutputSchema function to not let it recursively called down to the bottom of the plan