dongjoon-hyun commented on code in PR #49933: URL: https://github.com/apache/spark/pull/49933#discussion_r1954654468
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveHints.scala: ########## @@ -174,9 +174,23 @@ object ResolveHints { * COALESCE Hint accepts names "COALESCE", "REPARTITION", and "REPARTITION_BY_RANGE". */ object ResolveCoalesceHints extends Rule[LogicalPlan] { - - val COALESCE_HINT_NAMES: Set[String] = - Set("COALESCE", "REPARTITION", "REPARTITION_BY_RANGE", "REBALANCE") + private def getNumOfPartitions(hint: UnresolvedHint): (Option[Int], Seq[Any]) = { + hint.parameters match { + case Seq(ByteLiteral(numPartitions), _*) => + (Some(numPartitions.toInt), hint.parameters.tail) + case Seq(ShortLiteral(numPartitions), _*) => + (Some(numPartitions.toInt), hint.parameters.tail) + case Seq(IntegerLiteral(numPartitions), _*) => (Some(numPartitions), hint.parameters.tail) Review Comment: nit, This could be two line like the above two cases. ########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveHints.scala: ########## @@ -174,9 +174,23 @@ object ResolveHints { * COALESCE Hint accepts names "COALESCE", "REPARTITION", and "REPARTITION_BY_RANGE". */ object ResolveCoalesceHints extends Rule[LogicalPlan] { - - val COALESCE_HINT_NAMES: Set[String] = - Set("COALESCE", "REPARTITION", "REPARTITION_BY_RANGE", "REBALANCE") + private def getNumOfPartitions(hint: UnresolvedHint): (Option[Int], Seq[Any]) = { + hint.parameters match { + case Seq(ByteLiteral(numPartitions), _*) => + (Some(numPartitions.toInt), hint.parameters.tail) + case Seq(ShortLiteral(numPartitions), _*) => + (Some(numPartitions.toInt), hint.parameters.tail) + case Seq(IntegerLiteral(numPartitions), _*) => (Some(numPartitions), hint.parameters.tail) Review Comment: nit, This could be two line like the above two cases. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org