[ 
https://issues.apache.org/jira/browse/FLINK-6097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15930874#comment-15930874
 ] 

ASF GitHub Bot commented on FLINK-6097:
---------------------------------------

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

    https://github.com/apache/flink/pull/3560#discussion_r106761581
  
    --- 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 --
    
    Can you explain more about ` Especially the order is not defined very well, 
it will change easily if we modify the code.`?


> Guaranteed the order of the extracted field references
> ------------------------------------------------------
>
>                 Key: FLINK-6097
>                 URL: https://issues.apache.org/jira/browse/FLINK-6097
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table API & SQL
>            Reporter: sunjincheng
>            Assignee: sunjincheng
>
> The current `ProjectionTranslator # identifyFieldReferences` method uses the` 
> Set` 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. although the 
> out of order is also working, but I think the order is better than out of 
> order. So I want to improve it,Orderly extraction field.i.e.Guaranteed the 
> order of the extracted field references as input order.
> e.g.:
> Add the following elements in turn:
> {code}
> A, b, c, d, e
> Set (a)
> Class scala.collection.immutable.Set $ Set1
> Set (a, b)
> Class scala.collection.immutable.Set $ Set2
> Set (a, b, c)
> Class scala.collection.immutable.Set $ Set3
> Set (a, b, c, d)
> Class scala.collection.immutable.Set $ Set4
> Set (e, a, b, c, d) -> I want (a, b, c, d, e)
> Class scala.collection.immutable.HashSet $ HashTrieSet
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to