Github user sunjincheng121 commented on the issue:
https://github.com/apache/flink/pull/3560
HI, @KurtYoung Thanks for your attention to this PR. Good question, Here I
glad share why I notice this methodï¼
When we try to implement OVER window TableAPI, The first version of the
prototype to achieveï¼we do not consider the table field will be out of order
when we implement translateToPlan methodï¼then we set outputRow field from
inputRow according to the Initial order of the table field index.
At the beginning, the projections in the select statement less than 5
columns It works well.But Unfortunately when the count of projections bigger
than 4 (>=5), we got the random result. Then we debug the code, we find that
ProjectionTranslator # identifyFieldReferences method uses theSet temporary
save field, when the number of elements in the Set is less than 5, the Set
takes the Se1, Se2, Se3, Se4 data structures. When the number of elements is
greater than or equal to 5, the Set takes HashSet # HashTrieSet and which will
cause the data to be out of order. So we thought 2 approach to solve this
problemï¼
Let ProjectionTranslator # identifyFieldReferences method guaranteed the
order of the extracted field references same as input order.
We add the input and output field mapping.
At last we using approach#2 solve the problem. This change is not necessary
for the problem i have faced. But I feel it is better to let the output of this
method in the same order as the input, it may be very helpful for other cases,
though I am currently not aware of any. I am ok with not making this change,
but we should add a comment instead to highlight that the potential output of
the current output. Otherwise, some people may not pay attention to this and
assume it is in order.
Thanks,
SunJincheng
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---