Skip to content
Snippets Groups Projects
Commit 473552fa authored by scwf's avatar scwf Committed by Michael Armbrust
Browse files

[SPARK-7123] [SQL] support table.star in sqlcontext

Run following sql get error
`SELECT r.*
FROM testData l join testData2 r on (l.key = r.a)`

Author: scwf <wangfei1@huawei.com>

Closes #5690 from scwf/tablestar and squashes the following commits:

3b2e2b6 [scwf] support table.star
parent 3ba5aaab
No related branches found
No related tags found
No related merge requests found
......@@ -365,6 +365,7 @@ class SqlParser extends AbstractSparkSQLParser with DataTypeParser {
protected lazy val baseExpression: Parser[Expression] =
( "*" ^^^ UnresolvedStar(None)
| ident <~ "." ~ "*" ^^ { case tableName => UnresolvedStar(Option(tableName)) }
| primary
)
......
......@@ -51,6 +51,16 @@ class SQLQuerySuite extends QueryTest with BeforeAndAfterAll {
Row("1", 1) :: Row("2", 1) :: Row("3", 1) :: Nil)
}
test("support table.star") {
checkAnswer(
sql(
"""
|SELECT r.*
|FROM testData l join testData2 r on (l.key = r.a)
""".stripMargin),
Row(1, 1) :: Row(1, 2) :: Row(2, 1) :: Row(2, 2) :: Row(3, 1) :: Row(3, 2) :: Nil)
}
test("self join with alias in agg") {
Seq(1,2,3)
.map(i => (i, i.toString))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment