Skip to content

Commit b7367d7

Browse files
committed
Add more test cases
1 parent 8c29c48 commit b7367d7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3706,6 +3706,18 @@ class SQLQuerySuite extends QueryTest with SharedSparkSession with AdaptiveSpark
37063706
}
37073707
}
37083708
}
3709+
3710+
test("SPARK-33338: GROUP BY using literal map should not fail") {
3711+
withTempDir { dir =>
3712+
sql(s"CREATE TABLE t USING ORC LOCATION '${dir.toURI}' AS SELECT map('k1', 'v1') m, 'k1' k")
3713+
Seq(
3714+
"SELECT map('k1', 'v1')[k] FROM t GROUP BY 1",
3715+
"SELECT map('k1', 'v1')[k] FROM t GROUP BY map('k1', 'v1')[k]",
3716+
"SELECT map('k1', 'v1')[k] a FROM t GROUP BY a").foreach { statement =>
3717+
checkAnswer(sql(statement), Row("v1"))
3718+
}
3719+
}
3720+
}
37093721
}
37103722

37113723
case class Foo(bar: Option[String])

0 commit comments

Comments
 (0)