wangyum commented on a change in pull request #27632: [SPARK-30872][SQL]
Constraints inferred from inferred attributes
URL: https://github.com/apache/spark/pull/27632#discussion_r384385297
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
##########
@@ -3404,6 +3404,15 @@ class SQLQuerySuite extends QueryTest with
SharedSparkSession with AdaptiveSpark
""".stripMargin)
checkAnswer(df, Row(Row(1, 2)) :: Nil)
}
+
+ test("SPARK-30872: Constraints inferred from inferred attributes") {
Review comment:
It will throws `TreeNodeException`:
```
[info] - SPARK-30872: Constraints inferred from inferred attributes ***
FAILED *** (146 milliseconds)
[info] org.apache.spark.sql.catalyst.errors.package$TreeNodeException:
Once strategy's idempotence is broken for batch Infer Filters
[info] Aggregate [count(1) AS count(1)#19182L]
Aggregate [count(1) AS count(1)#19182L]
[info] +- Project
+- Project
[info] ! +- Filter ((((((a#19179L = c#19181L) AND isnotnull(b#19180L)) AND
isnotnull(c#19181L)) AND ((b#19180L = 3) OR (b#19180L = 13))) AND
isnotnull(a#19179L)) AND (((a#19179L = b#19180L) AND (b#19180L = c#19181L)) AND
((c#19181L = 3) OR (c#19181L = 13)))) +- Filter (((a#19179L = 3) OR
(a#19179L = 13)) AND ((((((a#19179L = c#19181L) AND isnotnull(b#19180L)) AND
isnotnull(c#19181L)) AND ((b#19180L = 3) OR (b#19180L = 13))) AND
isnotnull(a#19179L)) AND (((a#19179L = b#19180L) AND (b#19180L = c#19181L)) AND
((c#19181L = 3) OR (c#19181L = 13)))))
[info] +- Relation[a#19179L,b#19180L,c#19181L] parquet
+- Relation[a#19179L,b#19180L,c#19181L] parquet
[info] , tree:
[info] Aggregate [count(1) AS count(1)#19182L]
[info] +- Project
[info] +- Filter (((a#19179L = 3) OR (a#19179L = 13)) AND ((((((a#19179L
= c#19181L) AND isnotnull(b#19180L)) AND isnotnull(c#19181L)) AND ((b#19180L =
3) OR (b#19180L = 13))) AND isnotnull(a#19179L)) AND (((a#19179L = b#19180L)
AND (b#19180L = c#19181L)) AND ((c#19181L = 3) OR (c#19181L = 13)))))
[info] +- Relation[a#19179L,b#19180L,c#19181L] parquet
[info] at
org.apache.spark.sql.catalyst.rules.RuleExecutor.checkBatchIdempotence(RuleExecutor.scala:100)
[info] at
org.apache.spark.sql.catalyst.rules.RuleExecutor.$anonfun$execute$1(RuleExecutor.scala:187)
[info] at
org.apache.spark.sql.catalyst.rules.RuleExecutor.$anonfun$execute$1$adapted(RuleExecutor.scala:132)
[info] at scala.collection.immutable.List.foreach(List.scala:392)
[info] at
org.apache.spark.sql.catalyst.rules.RuleExecutor.execute(RuleExecutor.scala:132)
[info] at
org.apache.spark.sql.catalyst.rules.RuleExecutor.$anonfun$executeAndTrack$1(RuleExecutor.scala:111)
[info] at
org.apache.spark.sql.catalyst.QueryPlanningTracker$.withTracker(QueryPlanningTracker.scala:88)
[info] at
org.apache.spark.sql.catalyst.rules.RuleExecutor.executeAndTrack(RuleExecutor.scala:111)
[info] at
org.apache.spark.sql.execution.QueryExecution.$anonfun$optimizedPlan$1(QueryExecution.scala:82)
[info] at
org.apache.spark.sql.catalyst.QueryPlanningTracker.measurePhase(QueryPlanningTracker.scala:111)
[info] at
org.apache.spark.sql.execution.QueryExecution.$anonfun$executePhase$1(QueryExecution.scala:119)
[info] at
org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:762)
[info] at
org.apache.spark.sql.execution.QueryExecution.executePhase(QueryExecution.scala:119)
[info] at
org.apache.spark.sql.execution.QueryExecution.optimizedPlan$lzycompute(QueryExecution.scala:82)
[info] at
org.apache.spark.sql.execution.QueryExecution.optimizedPlan(QueryExecution.scala:79)
[info] at
org.apache.spark.sql.QueryTest.assertEmptyMissingInput(QueryTest.scala:231)
[info] at org.apache.spark.sql.QueryTest.checkAnswer(QueryTest.scala:154)
[info] at
org.apache.spark.sql.SQLQuerySuite.$anonfun$new$746(SQLQuerySuite.scala:3413)
[info] at
scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
```
----------------------------------------------------------------
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]