You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/06/23 16:38:48 UTC

[GitHub] [spark] sunchao commented on a change in pull request #32932: [SPARK-35786][SQL] Add a new operator to distingush if AQE can optimize safely

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



##########
File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/ResolveHintsSuite.scala
##########
@@ -295,4 +296,28 @@ class ResolveHintsSuite extends AnalysisTest {
         caseSensitive = true)
     }
   }
+
+  test("SPARK-35786: Support optimize repartition by expression in AQE") {
+    checkAnalysisWithoutViewWrapper(
+      UnresolvedHint("REBALANCE_PARTITIONS", Seq(UnresolvedAttribute("a")), table("TaBlE")),
+      RebalancePartitions(Seq(AttributeReference("a", IntegerType)()), testRelation))
+
+    checkAnalysisWithoutViewWrapper(
+      UnresolvedHint("REBALANCE_PARTITIONS", Seq.empty, table("TaBlE")),
+      RebalancePartitions(Seq.empty, testRelation))
+
+    withSQLConf(SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "false") {
+      checkAnalysisWithoutViewWrapper(
+        UnresolvedHint("REBALANCE_PARTITIONS", Seq(UnresolvedAttribute("a")), table("TaBlE")),
+        testRelation)
+
+      checkAnalysisWithoutViewWrapper(
+        UnresolvedHint("REBALANCE_PARTITIONS", Seq.empty, table("TaBlE")),
+        testRelation)
+    }
+
+    assertAnalysisError(
+      UnresolvedHint("REBALANCE_PARTITIONS", Seq(Literal(1)), table("TaBlE")),

Review comment:
       @cloud-fan yea I think it would be useful in general to support transforms as partition expressions. To achieve that, we'll need to first link the transforms with their actual semantics through function catalog (this is on my radar), and also allow plugin custom shuffle function in `ShuffleExchangeLike`. After that perhaps `RebalancePartitions` here can return `DataSourcePartitioning` when the partition expressions include transforms.




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org