maropu commented on a change in pull request #25464: [SPARK-28746][SQL] Add 
partitionby hint  for sql queries
URL: https://github.com/apache/spark/pull/25464#discussion_r316954725
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveHints.scala
 ##########
 @@ -143,22 +143,41 @@ object ResolveHints {
   object ResolveCoalesceHints extends Rule[LogicalPlan] {
     private val COALESCE_HINT_NAMES = Set("COALESCE", "REPARTITION")
 
+    private def createRepartitionByExpression(
+        numPartitions: Int, parameters: Seq[Any], h: UnresolvedHint): 
RepartitionByExpression = {
+      val exprs = parameters.drop(1)
+      val errExprs = exprs.filter(!_.isInstanceOf[UnresolvedAttribute])
+      if (errExprs.nonEmpty) throw new AnalysisException(
+        s"""Invalid type exprs : $errExprs
+           |expects UnresolvedAttribute type
+        """.stripMargin)
+      RepartitionByExpression(
+        exprs.map(_.asInstanceOf[UnresolvedAttribute]), h.child, numPartitions)
+    }
+
 
 Review comment:
   How about the case, `SELECT /*+ REPARTITION(a) */ * FROM t`?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to