[ https://issues.apache.org/jira/browse/SPARK-32143?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lantao Jin updated SPARK-32143: ------------------------------- Description: In handling skewed SortMergeJoin, when matching partitions from the left side and the right side both have skew, the the plan generation may take a very long time. Even fallback to normal SMJ, the query cannot success either. So we should fast fail this query. In below logs we can see that it took over 1 hour to generate the plan in AQE when handle a skewed join which produced too many splits. {quote}20/06/30 *12:31:26,271* INFO [HiveServer2-Background-Pool: Thread-821384] adaptive.OptimizeSkewedJoin:54 : 20/06/30 12:31:26,299 INFO [HiveServer2-Background-Pool: Thread-821384] adaptive.OptimizeSkewedJoin:54 : Left side partition 1 (3 TB) is skewed, split it into *39150* parts. 20/06/30 12:31:26,315 INFO [HiveServer2-Background-Pool: Thread-821384] adaptive.OptimizeSkewedJoin:54 : Right side partition 1 (11 TB) is skewed, split it into *17022* parts. 20/06/30 12:32:24,952 INFO [HiveServer2-Background-Pool: Thread-821384] adaptive.OptimizeSkewedJoin:54 : Right side partition 8 (1 GB) is skewed, split it into 17 parts. ... 20/06/30 *13:27:25,158* INFO [HiveServer2-Background-Pool: Thread-821384] adaptive.AdaptiveSparkPlanExec:54 : Final plan: CollectLimit 1000 {quote} was: In handling skewed SortMergeJoin, when matching partitions from the left side and the right side both have skew, the the plan generation may take a very long time. Actually, this query cannot success. In below logs we can see that it took over 1 hour to generate the plan in AQE when handle a skewed join which produced too many splits. {quote}20/06/30 *12:31:26,271* INFO [HiveServer2-Background-Pool: Thread-821384] adaptive.OptimizeSkewedJoin:54 : 20/06/30 12:31:26,299 INFO [HiveServer2-Background-Pool: Thread-821384] adaptive.OptimizeSkewedJoin:54 : Left side partition 1 (3 TB) is skewed, split it into *39150* parts. 20/06/30 12:31:26,315 INFO [HiveServer2-Background-Pool: Thread-821384] adaptive.OptimizeSkewedJoin:54 : Right side partition 1 (11 TB) is skewed, split it into *17022* parts. 20/06/30 12:32:24,952 INFO [HiveServer2-Background-Pool: Thread-821384] adaptive.OptimizeSkewedJoin:54 : Right side partition 8 (1 GB) is skewed, split it into 17 parts. ... 20/06/30 *13:27:25,158* INFO [HiveServer2-Background-Pool: Thread-821384] adaptive.AdaptiveSparkPlanExec:54 : Final plan: CollectLimit 1000 {quote} > Fast fail when the AQE skew join produce too many splits > -------------------------------------------------------- > > Key: SPARK-32143 > URL: https://issues.apache.org/jira/browse/SPARK-32143 > Project: Spark > Issue Type: Bug > Components: SQL > Affects Versions: 3.0.0, 3.1.0 > Reporter: Lantao Jin > Priority: Major > > In handling skewed SortMergeJoin, when matching partitions from the left side > and the right side both have skew, the the plan generation may take a very > long time. > Even fallback to normal SMJ, the query cannot success either. So we should > fast fail this query. > In below logs we can see that it took over 1 hour to generate the plan in > AQE when handle a skewed join which produced too many splits. > {quote}20/06/30 *12:31:26,271* INFO [HiveServer2-Background-Pool: > Thread-821384] adaptive.OptimizeSkewedJoin:54 : > 20/06/30 12:31:26,299 INFO [HiveServer2-Background-Pool: Thread-821384] > adaptive.OptimizeSkewedJoin:54 : Left side partition 1 (3 TB) is skewed, > split it into *39150* parts. > 20/06/30 12:31:26,315 INFO [HiveServer2-Background-Pool: Thread-821384] > adaptive.OptimizeSkewedJoin:54 : Right side partition 1 (11 TB) is skewed, > split it into *17022* parts. > 20/06/30 12:32:24,952 INFO [HiveServer2-Background-Pool: Thread-821384] > adaptive.OptimizeSkewedJoin:54 : Right side partition 8 (1 GB) is skewed, > split it into 17 parts. > ... > 20/06/30 *13:27:25,158* INFO [HiveServer2-Background-Pool: Thread-821384] > adaptive.AdaptiveSparkPlanExec:54 : Final plan: CollectLimit 1000 > {quote} -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org