sunchao commented on a change in pull request #35657:
URL: https://github.com/apache/spark/pull/35657#discussion_r827144086



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/V2ExpressionUtils.scala
##########
@@ -44,20 +52,108 @@ object V2ExpressionUtils extends SQLConfHelper {
     refs.map(ref => resolveRef[T](ref, plan))
   }
 
-  def toCatalyst(expr: V2Expression, query: LogicalPlan): Expression = {
+  /**
+   * Converts the array of input V2 [[V2SortOrder]] into their counterparts in 
catalyst.
+   */
+  def toCatalystOrdering(ordering: Array[V2SortOrder], query: LogicalPlan): 
Seq[SortOrder] = {
+    sequenceToOption(ordering.map(toCatalyst(_, 
query))).asInstanceOf[Option[Seq[SortOrder]]]
+        .getOrElse(Seq.empty)
+  }
+
+  /**
+   * Converts the V2 [[V2Distribution]] into its counterpart in catalyst 
[[Distribution]].
+   *
+   * If `funCatalogOpt` is set, it will be used to lookup any V2 function 
referenced
+   * by the input distribution. For instance, a bucket transform in the 
distribution requires a
+   * corresponding function to exist in the catalog, in order for Spark to 
leverage bucket join
+   * for the V2 data sources.
+   *
+   * This returns [[UnspecifiedDistribution]] if any non-identity transform is 
used in the
+   * distribution, AND the `funCatalogOpt` is not set OR the corresponding 
function is not
+   * defined in the catalog.
+   */
+  def toCatalystDistribution(
+      distribution: V2Distribution,

Review comment:
       Yea this is not too much useful now. It is only used by 
`DistributionAndOrderingUtils` at the moment.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to