Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-46640

RemoveRedundantAliases does not account for SubqueryExpression when removing aliases

    XMLWordPrintableJSON

Details

    Description

      `RemoveRedundantAliases` does not take into account the outer attributes of a `SubqueryExpression` aliases, potentially removing them if it thinks they are redundant.

      This can cause scenarios where a subquery expression has conditions like `a#x = a#x` i.e. both the attribute names and the expression ID(s) are the same. This can then lead to conflicting expression ID(s) error.

      In `RemoveRedundantAliases`, we have an excluded AttributeSet argument denoting the references for which we should not remove aliases. For a query with a subquery expression, adding the references of this subquery in the excluded set prevents such rewrite from happening.

      Attachments

        Issue Links

          Activity

            People

              nikhilsheoran-db Nikhil Sheoran
              nikhilsheoran-db Nikhil Sheoran
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: