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

Failed to infer constraints over multiple aliases

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.2, 2.1.0
    • Component/s: SQL
    • Labels:
      None

      Description

      The `UnaryNode.getAliasedConstraints` function fails to replace all expressions by their alias where constraints contains more than one expression to be replaced. For example:

      val tr = LocalRelation('a.int, 'b.string, 'c.int)
      val multiAlias = tr.where('a === 'c + 10).select('a.as('x), 'c.as('y))
      multiAlias.analyze.constraints
      

      currently outputs:

      ExpressionSet(Seq(
          IsNotNull(resolveColumn(multiAlias.analyze, "x")),
          IsNotNull(resolveColumn(multiAlias.analyze, "y"))
      )
      

      The constraint

      resolveColumn(multiAlias.analyze, "x") === resolveColumn(multiAlias.analyze, "y") + 10)

      is missing.

        Attachments

          Activity

            People

            • Assignee:
              jiangxb1987 Xingbo Jiang
              Reporter:
              jiangxb1987 Xingbo Jiang
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: