New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FLINK-6097][table] Guaranteed the order of the extracted field refer… #3560
Conversation
…ences as input order.
} | ||
|
||
private def identifyFieldReferences( | ||
expr: Expression, | ||
fieldReferences: Set[NamedExpression]): Set[NamedExpression] = expr match { | ||
fieldReferences: List[NamedExpression]): List[NamedExpression] = expr match { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using Set here gave us better intuition that we actually want to count uniq fields, any reason why you want to keep the order? Especially the order is not defined very well, it will change easily if we modify the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain more about Especially the order is not defined very well, it will change easily if we modify the code.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order is really depending on how we extract fields from all kinds of expressions. Like BinaryExpression
, we first extract left child
, and then right child
. And for Funtion Calls
, we extract the field from parameter with left to right order. More complex example will be over
, imagine there is an aggregate on a partitioned window. Should the fields appeared in the aggregate or the field which partitioned on should be considered first?
IMO this kind of order is hard to define and hard to stay consistency, it will change easily when we modifying the codes. We should not rely anything on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also use a LinkedHashSet
which preserves the order in which elements are inserted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @sunjincheng121 , i'm curious what's purpose of this change. Can you give me an example what the order is used for?
HI, @KurtYoung Thanks for your attention to this PR. Good question, Here I glad share why I notice this method: Let ProjectionTranslator # identifyFieldReferences method guaranteed the order of the extracted field references same as input order. Thanks, |
Hi @sunjincheng121, thanks for explaining the issue, but I did not completely understand the problem. The |
Can you close this PR as well @sunjincheng121? |
…ences as input order.
Thanks for contributing to Apache Flink. Before you open your pull request, please take the following check list into consideration.
If your changes take all of the items into account, feel free to open your pull request. For more information and/or questions please refer to the How To Contribute guide.
In addition to going through the list, please provide a meaningful description of your changes.
General
Documentation
[x ] Build
mvn clean verify
has been executed successfully locally or a Travis build has passed