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

    https://github.com/apache/flink/pull/3889#discussion_r123712536
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/plan/nodes/dataset/DataSetSort.scala
 ---
    @@ -136,36 +130,21 @@ class DataSetSort(
         }
       }
     
    -  private def directionToOrder(direction: Direction) = {
    -    direction match {
    -      case Direction.ASCENDING | Direction.STRICTLY_ASCENDING => 
Order.ASCENDING
    -      case Direction.DESCENDING | Direction.STRICTLY_DESCENDING => 
Order.DESCENDING
    -      case _ => throw new IllegalArgumentException("Unsupported 
direction.")
    -    }
    -
    -  }
    -
       private val fieldCollations = collations.getFieldCollations.asScala
         .map(c => (c.getFieldIndex, directionToOrder(c.getDirection)))
     
    -  private val sortFieldsToString = fieldCollations
    -    .map(col => s"${getRowType.getFieldNames.get(col._1)} 
${col._2.getShortName}" ).mkString(", ")
    -
    -  private val offsetToString = s"$offset"
    -
    -  private val fetchToString = if (limitEnd == Long.MaxValue) {
    -    "unlimited"
    -  } else {
    -    s"$limitEnd"
    +    
    +  override def toString: String = {
    +    s"Sort(by: ($$sortFieldsToString(collations, getRowType))," +
    +      " offset: $offsetToString(offset)," +
    +      " fetch: $fetchToString(fetch, offset))"
       }
    -
    -  override def toString: String =
    -    s"Sort(by: ($sortFieldsToString), offset: $offsetToString, fetch: 
$fetchToString)"
    -
    +    
    +    
       override def explainTerms(pw: RelWriter) : RelWriter = {
         super.explainTerms(pw)
    -      .item("orderBy", sortFieldsToString)
    -      .item("offset", offsetToString)
    -      .item("fetch", fetchToString)
    +      .item("orderBy", sortFieldsToString(collations, getRowType))
    --- End diff --
    
    Move the implementation to `CommonSort`


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