Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
AngersZhuuuu committed Oct 24, 2019
1 parent 4ba7a17 commit 307802a
Showing 1 changed file with 28 additions and 14 deletions.
42 changes: 28 additions & 14 deletions sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,17 @@ class SubquerySuite extends QueryTest with SharedSparkSession {
"""
| SELECT s1.id FROM s1
| JOIN s2 ON s1.id = s2.id
| AND s1.id IN (SELECT 9)""".stripMargin),
| AND s1.id IN (SELECT 9)
""".stripMargin),
Row(9) :: Nil)

checkAnswer(
sql(
"""
| SELECT s1.id FROM s1
| JOIN s2 ON s1.id = s2.id
| AND s1.id NOT IN (SELECT 9)""".stripMargin),
| AND s1.id NOT IN (SELECT 9)
""".stripMargin),
Row(1) :: Row(3) :: Nil)

// case `IN`
Expand All @@ -232,7 +234,8 @@ class SubquerySuite extends QueryTest with SharedSparkSession {
"""
| SELECT s1.id FROM s1
| JOIN s2 ON s1.id = s2.id
| AND s1.id IN (SELECT id FROM s3)""".stripMargin),
| AND s1.id IN (SELECT id FROM s3)
""".stripMargin),
Row(3) :: Row(9) :: Nil)

checkAnswer(
Expand All @@ -241,7 +244,8 @@ class SubquerySuite extends QueryTest with SharedSparkSession {
| SELECT s1.id AS id2 FROM s1
| LEFT SEMI JOIN s2
| ON s1.id = s2.id
| AND s1.id IN (SELECT id FROM s3)""".stripMargin),
| AND s1.id IN (SELECT id FROM s3)
""".stripMargin),
Row(3) :: Row(9) :: Nil)

checkAnswer(
Expand All @@ -250,7 +254,8 @@ class SubquerySuite extends QueryTest with SharedSparkSession {
| SELECT s1.id as id2 FROM s1
| LEFT ANTI JOIN s2
| ON s1.id = s2.id
| AND s1.id IN (SELECT id FROM s3)""".stripMargin),
| AND s1.id IN (SELECT id FROM s3)
""".stripMargin),
Row(1) :: Row(5) :: Row(7) :: Nil)

checkAnswer(
Expand All @@ -259,7 +264,8 @@ class SubquerySuite extends QueryTest with SharedSparkSession {
| SELECT s1.id, s2.id as id2 FROM s1
| LEFT OUTER JOIN s2
| ON s1.id = s2.id
| AND s1.id IN (SELECT id FROM s3)""".stripMargin),
| AND s1.id IN (SELECT id FROM s3)
""".stripMargin),
Row(1, null) :: Row(3, 3) :: Row(5, null) :: Row(7, null) :: Row(9, 9) :: Nil)

checkAnswer(
Expand All @@ -268,7 +274,8 @@ class SubquerySuite extends QueryTest with SharedSparkSession {
| SELECT s1.id, s2.id as id2 FROM s1
| RIGHT OUTER JOIN s2
| ON s1.id = s2.id
| AND s1.id IN (SELECT id FROM s3)""".stripMargin),
| AND s1.id IN (SELECT id FROM s3)
""".stripMargin),
Row(null, 1) :: Row(3, 3) :: Row(null, 4) :: Row(null, 6) :: Row(9, 9) :: Nil)

checkAnswer(
Expand All @@ -277,7 +284,8 @@ class SubquerySuite extends QueryTest with SharedSparkSession {
| SELECT s1.id, s2.id AS id2 FROM s1
| FULL OUTER JOIN s2
| ON s1.id = s2.id
| AND s1.id IN (SELECT id FROM s3)""".stripMargin),
| AND s1.id IN (SELECT id FROM s3)
""".stripMargin),
Row(1, null) :: Row(3, 3) :: Row(5, null) :: Row(7, null) :: Row(9, 9) ::
Row(null, 1) :: Row(null, 4) :: Row(null, 6) :: Nil)

Expand All @@ -287,7 +295,8 @@ class SubquerySuite extends QueryTest with SharedSparkSession {
"""
| SELECT s1.id FROM s1
| JOIN s2 ON s1.id = s2.id
| AND s1.id NOT IN (SELECT id FROM s3)""".stripMargin),
| AND s1.id NOT IN (SELECT id FROM s3)
""".stripMargin),
Row(1) :: Nil)

checkAnswer(
Expand All @@ -296,7 +305,8 @@ class SubquerySuite extends QueryTest with SharedSparkSession {
| SELECT s1.id AS id2 FROM s1
| LEFT SEMI JOIN s2
| ON s1.id = s2.id
| AND s1.id NOT IN (SELECT id FROM s3)""".stripMargin),
| AND s1.id NOT IN (SELECT id FROM s3)
""".stripMargin),
Row(1) :: Nil)

checkAnswer(
Expand All @@ -305,7 +315,8 @@ class SubquerySuite extends QueryTest with SharedSparkSession {
| SELECT s1.id AS id2 FROM s1
| LEFT ANTI JOIN s2
| ON s1.id = s2.id
| AND s1.id NOT IN (SELECT id FROM s3)""".stripMargin),
| AND s1.id NOT IN (SELECT id FROM s3)
""".stripMargin),
Row(3) :: Row(5) :: Row(7) :: Row(9) :: Nil)

checkAnswer(
Expand All @@ -314,7 +325,8 @@ class SubquerySuite extends QueryTest with SharedSparkSession {
| SELECT s1.id, s2.id AS id2 FROM s1
| LEFT OUTER JOIN s2
| ON s1.id = s2.id
| AND s1.id NOT IN (SELECT id FROM s3)""".stripMargin),
| AND s1.id NOT IN (SELECT id FROM s3)
""".stripMargin),
Row(1, 1) :: Row(3, null) :: Row(5, null) :: Row(7, null) :: Row(9, null) :: Nil)

checkAnswer(
Expand All @@ -323,7 +335,8 @@ class SubquerySuite extends QueryTest with SharedSparkSession {
| SELECT s1.id, s2.id AS id2 FROM s1
| RIGHT OUTER JOIN s2
| ON s1.id = s2.id
| AND s1.id NOT IN (SELECT id FROM s3)""".stripMargin),
| AND s1.id NOT IN (SELECT id FROM s3)
""".stripMargin),
Row(1, 1) :: Row(null, 3) :: Row(null, 4) :: Row(null, 6) :: Row(null, 9) :: Nil)

checkAnswer(
Expand All @@ -332,7 +345,8 @@ class SubquerySuite extends QueryTest with SharedSparkSession {
| SELECT s1.id, s2.id AS id2 FROM s1
| FULL OUTER JOIN s2
| ON s1.id = s2.id
| AND s1.id NOT IN (SELECT id FROM s3)""".stripMargin),
| AND s1.id NOT IN (SELECT id FROM s3)
""".stripMargin),
Row(1, 1) :: Row(3, null) :: Row(5, null) :: Row(7, null) :: Row(9, null) ::
Row(null, 3) :: Row(null, 4) :: Row(null, 6) :: Row(null, 9) :: Nil)
}
Expand Down

0 comments on commit 307802a

Please sign in to comment.