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

    https://github.com/apache/spark/pull/21911#discussion_r207701114
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveHints.scala
 ---
    @@ -102,6 +104,32 @@ object ResolveHints {
         }
       }
     
    +  /**
    +   * COALESCE Hint accepts name "COALESCE" and "REPARTITION".
    +   * Its parameter includes a partition number.
    +   */
    +  object ResolveCoalesceHints extends Rule[LogicalPlan] {
    +    private val COALESCE_HINT_NAMES = Set("COALESCE", "REPARTITION")
    +
    +    def apply(plan: LogicalPlan): LogicalPlan = plan.resolveOperators {
    +      case h: UnresolvedHint if 
COALESCE_HINT_NAMES.contains(h.name.toUpperCase(Locale.ROOT)) =>
    +        val hintName = h.name.toUpperCase(Locale.ROOT)
    +        val shuffle = hintName match {
    +          case "REPARTITION" => true
    +          case "COALESCE" => false
    +        }
    +        val numPartitions = h.parameters match {
    +          case Seq(Literal(numPartitions: Int, IntegerType)) =>
    --- End diff --
    
    Use `IntegerLiteral`


---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to