> > Yes, I'm referring to the RelNode's row type, the planBefore and > planAfter's row types are different in field name. >
You cannot rely on field names from individual RelNodes. It's just the way Calcite was designed. I'm trying to convert the optimized RelNodes tree to a sql with same > semantics with the original RelNodes, > If the field name is missing, the sql will be incorrect. > You should be using the RelRoot's validated row type to generate the field names of the output, not the RelNode's. They will be correct. If you're constructing the plan by hand, you'll need to create a rowtype independent of the relnodes to maintain the field names through the process. > Thanks JiaTao and Jing, I understand the fact that alias is trivial in > rules, But how can Calcite ensure the physical plan > which transformed from optimized logical plan outputs the correct column > names? > By using the RelRoot's validated row type.
