Skip to content

Commit

Permalink
Added test case for SPARK-4487
Browse files Browse the repository at this point in the history
  • Loading branch information
sarutak committed Nov 19, 2014
1 parent 282d529 commit cb5b7e9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,7 @@ class SqlParser extends AbstractSparkSQLParser {

protected lazy val productExpression: Parser[Expression] =
baseExpression *
( "||" ^^^ { e1: Expression, e2: Expression) => Concat(e1, e2) }
| "*" ^^^ { (e1: Expression, e2: Expression) => Multiply(e1, e2) }
( "*" ^^^ { (e1: Expression, e2: Expression) => Multiply(e1, e2) }
| "/" ^^^ { (e1: Expression, e2: Expression) => Divide(e1, e2) }
| "%" ^^^ { (e1: Expression, e2: Expression) => Remainder(e1, e2) }
| "&" ^^^ { (e1: Expression, e2: Expression) => BitwiseAnd(e1, e2) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ case class Lower(child: Expression) extends UnaryExpression with CaseConversionE
override def toString() = s"Lower($child)"
}

case class Concat(child: Expresson) extends BinaryExpression

/** A base trait for functions that compare two strings, returning a boolean. */
trait StringComparison {
self: BinaryExpression =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -973,4 +973,11 @@ class SQLQuerySuite extends QueryTest with BeforeAndAfterAll {
checkAnswer(sql("SELECT a.b + 1 FROM data GROUP BY a.b + 1"), 2)
dropTempTable("data")
}

test("SPARK-4432 Fix attribute reference resolution error when using ORDER BY") {
checkAnswer(
sql("SELECT a + b FROM testData2 ORDER BY a"),
Seq(2, 3, 3 ,4 ,4 ,5).map(Seq(_))
)
}
}

0 comments on commit cb5b7e9

Please sign in to comment.