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

Failed to infer constraints over multiple aliases

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 2.0.2, 2.1.0
    • SQL
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: