fix: from_plan generate incorrect schema when it is Aggregate#6862
fix: from_plan generate incorrect schema when it is Aggregate#6862YjyJeff wants to merge 1 commit intoapache:mainfrom YjyJeff:fix/from_plan_incorrect_schema
Conversation
…ression may have different schema with the old one
|
There is related issue or specific example? It's legacy code, exists with some reason. If there are no specific reasons, we should not change it. |
|
I have not created the issue, should we create an issue to talk about it? I found this problem in our custom optimizer. In our optimizer, we will change the return type of the expression. For example, if we have the query and the type of
What are the reasons? In my view, |
currently, we can't change |
|
Ok, I know the reasons now. However, the |
Yes, I think we indeed need to resolve this problem, but it's troublesome. It needs to take more time to discuss how to solve this problem. I add a comment #6790 (comment) to explain reason for this. Hope it can help others in community. |
|
cc @alamb |
Rationale for this change
For the
from_planfunction, we want to generate a new logical plan with inputs and expressions replaced. When we encounter theAggregatevariant, the old code simply clones the old schema. However, the newgroup by expressionsmay have a different schema from the old one. Therefore, we should use thetry_newfunction to create a newAggregatevariant with the correct schema.Are these changes tested?
Yes
Are there any user-facing changes?
No