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

Improve QueryPlanConstraints framework

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.3.0
    • Component/s: SQL
    • Labels:
      None

      Description

      Improve QueryPlanConstraints framework, make it robust and simple.
      In apache/spark#15319, constraints for expressions like a = f(b, c) is resolved.
      However, for expressions like

      a = f(b, c) && c = g(a, b)
      The current QueryPlanConstraints framework will produce non-converging constraints.
      Essentially, the problem is caused by having both the name and child of aliases in the same constraint set. We infer constraints, and push down constraints as predicates in filters, later on these predicates are propagated as constraints, etc..
      Simply using the alias names only can resolve these problems. The size of constraints is reduced without losing any information. We can always get these inferred constraints on child of aliases when pushing down filters.

      Also, the EqualNullSafe between name and child in propagating alias is meaningless

      allConstraints += EqualNullSafe(e, a.toAttribute)
      It just produce redundant constraints.

        Attachments

          Activity

            People

            • Assignee:
              Gengliang.Wang Gengliang Wang
              Reporter:
              Gengliang.Wang Gengliang Wang
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: