Github user KurtYoung commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3560#discussion_r106772134
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/ProjectionTranslator.scala
 ---
    @@ -227,18 +227,23 @@ object ProjectionTranslator {
         * @param exprs a list of expressions to extract
         * @return a list of field references extracted from the given 
expressions
         */
    -  def extractFieldReferences(exprs: Seq[Expression]): Seq[NamedExpression] 
= {
    -    exprs.foldLeft(Set[NamedExpression]()) {
    +  def extractFieldReferences(exprs: Seq[Expression]): 
List[NamedExpression] = {
    +    exprs.foldLeft(List[NamedExpression]()) {
           (fieldReferences, expr) => identifyFieldReferences(expr, 
fieldReferences)
    -    }.toSeq
    +    }
       }
     
       private def identifyFieldReferences(
           expr: Expression,
    -      fieldReferences: Set[NamedExpression]): Set[NamedExpression] = expr 
match {
    +      fieldReferences: List[NamedExpression]): List[NamedExpression] = 
expr match {
    --- End diff --
    
    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? 
    
    So i think 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. 


---
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.
---

Reply via email to