Github user cloud-fan commented on a diff in the pull request: https://github.com/apache/spark/pull/22713#discussion_r225025827 --- Diff: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/RemoveRedundantAliasAndProjectSuite.scala --- @@ -124,4 +124,11 @@ class RemoveRedundantAliasAndProjectSuite extends PlanTest with PredicateHelper val expected = Subquery(relation.select('a as "a", 'b).where('b < 10).select('a).analyze) comparePlans(optimized, expected) } + + test("SPARK-25691: RemoveRedundantProject works also with different cases") { + val relation = LocalRelation('a.int, 'b.int) + val query = relation.select('A, 'b).analyzeCaseInsensitive + val optimized = Optimize.execute(query) + comparePlans(optimized, relation) --- End diff -- I agree that using `==` on attributes is error-prone, but we should update then one-by-one, to narrow down the scope and make sure the change is reasonable. For instance, I don't think this is a valid case. If we optimize it, the final schema field names will change, which is a breaking change if this plan an input of a parquet writing plan. (the result parquet files will have a different schema)
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org