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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]