ulysses you created SPARK-30353: ----------------------------------- Summary: Use constraints in SimplifyBinaryComparison optimization Key: SPARK-30353 URL: https://issues.apache.org/jira/browse/SPARK-30353 Project: Spark Issue Type: Improvement Components: SQL Affects Versions: 3.0.0 Reporter: ulysses you
Now Spark can propagate constraint during sql optimization when `spark.sql.constraintPropagation.enabled` is true, then `where c = 1` will convert to `where c = 1 and c is not null`. We also can use constraint in `SimplifyBinaryComparison`. `SimplifyBinaryComparison` will simplify expression which is not nullable and semanticEquals. Besides we also can simplify if one expression is infered `IsNotNull`. For e.g. ``` create table test (c1 string); explain extended select c1 from test where c1 = c1 limit 10; -- before GlobalLimit 10 +- LocalLimit 10 +- Filter (isnotnull(c1#20) AND (c1#20 = c1#20)) +- Relation[c1#20] -- after GlobalLimit 10 +- LocalLimit 10 +- Relation[c1#20] ``` -- 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