Skip to content

Commit

Permalink
Add more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
dongjoon-hyun committed Nov 4, 2020
1 parent 8c29c48 commit b7367d7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3706,6 +3706,18 @@ class SQLQuerySuite extends QueryTest with SharedSparkSession with AdaptiveSpark
}
}
}

test("SPARK-33338: GROUP BY using literal map should not fail") {
withTempDir { dir =>
sql(s"CREATE TABLE t USING ORC LOCATION '${dir.toURI}' AS SELECT map('k1', 'v1') m, 'k1' k")
Seq(
"SELECT map('k1', 'v1')[k] FROM t GROUP BY 1",
"SELECT map('k1', 'v1')[k] FROM t GROUP BY map('k1', 'v1')[k]",
"SELECT map('k1', 'v1')[k] a FROM t GROUP BY a").foreach { statement =>
checkAnswer(sql(statement), Row("v1"))
}
}
}
}

case class Foo(bar: Option[String])

0 comments on commit b7367d7

Please sign in to comment.