Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ SELECT * FROM testdata LIMIT key > 3
struct<>
-- !query output
org.apache.spark.sql.AnalysisException
The limit expression must evaluate to a constant value, but got (testdata.`key` > 3);
The limit expression must evaluate to a constant value, but got (spark_catalog.default.testdata.`key` > 3);


-- !query
Expand Down
12 changes: 0 additions & 12 deletions sql/core/src/test/resources/sql-tests/results/show-tables.sql.out
Original file line number Diff line number Diff line change
Expand Up @@ -63,31 +63,19 @@ SHOW TABLES
-- !query schema
struct<database:string,tableName:string,isTemporary:boolean>
-- !query output
aggtest
arraydata
mapdata
onek
show_t1
show_t2
show_t3
tenk1
testdata


-- !query
SHOW TABLES IN showdb
-- !query schema
struct<database:string,tableName:string,isTemporary:boolean>
-- !query output
aggtest
arraydata
mapdata
onek
show_t1
show_t2
show_t3
tenk1
testdata


-- !query
Expand Down
24 changes: 0 additions & 24 deletions sql/core/src/test/resources/sql-tests/results/show-views.sql.out
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ SHOW VIEWS
-- !query schema
struct<namespace:string,viewName:string,isTemporary:boolean>
-- !query output
aggtest
arraydata
mapdata
onek
tenk1
testdata
view_1
view_2
view_4
Expand All @@ -79,12 +73,6 @@ SHOW VIEWS FROM showdb
-- !query schema
struct<namespace:string,viewName:string,isTemporary:boolean>
-- !query output
aggtest
arraydata
mapdata
onek
tenk1
testdata
view_1
view_2
view_4
Expand All @@ -95,12 +83,6 @@ SHOW VIEWS IN showdb
-- !query schema
struct<namespace:string,viewName:string,isTemporary:boolean>
-- !query output
aggtest
arraydata
mapdata
onek
tenk1
testdata
view_1
view_2
view_4
Expand All @@ -111,12 +93,6 @@ SHOW VIEWS IN global_temp
-- !query schema
struct<namespace:string,viewName:string,isTemporary:boolean>
-- !query output
aggtest
arraydata
mapdata
onek
tenk1
testdata
view_3
view_4

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ class SQLQueryTestSuite extends QueryTest with SharedSparkSession {
// Create a local SparkSession to have stronger isolation between different test cases.
// This does not isolate catalog changes.
val localSparkSession = spark.newSession()
loadTestData(localSparkSession)

testCase match {
case udfTestCase: UDFTest =>
Expand Down Expand Up @@ -572,30 +571,40 @@ class SQLQueryTestSuite extends QueryTest with SharedSparkSession {
}

/** Load built-in test tables into the SparkSession. */
private def loadTestData(session: SparkSession): Unit = {
private def createTestTables(session: SparkSession): Unit = {
import session.implicits._

(1 to 100).map(i => (i, i.toString)).toDF("key", "value").createOrReplaceTempView("testdata")
(1 to 100).map(i => (i, i.toString)).toDF("key", "value")
.repartition(1)
.write
.format("parquet")
.saveAsTable("testdata")

((Seq(1, 2, 3), Seq(Seq(1, 2, 3))) :: (Seq(2, 3, 4), Seq(Seq(2, 3, 4))) :: Nil)
.toDF("arraycol", "nestedarraycol")
.createOrReplaceTempView("arraydata")
.write
.format("parquet")
.saveAsTable("arraydata")

(Tuple1(Map(1 -> "a1", 2 -> "b1", 3 -> "c1", 4 -> "d1", 5 -> "e1")) ::
Tuple1(Map(1 -> "a2", 2 -> "b2", 3 -> "c2", 4 -> "d2")) ::
Tuple1(Map(1 -> "a3", 2 -> "b3", 3 -> "c3")) ::
Tuple1(Map(1 -> "a4", 2 -> "b4")) ::
Tuple1(Map(1 -> "a5")) :: Nil)
.toDF("mapcol")
.createOrReplaceTempView("mapdata")
.write
.format("parquet")
.saveAsTable("mapdata")

session
.read
.format("csv")
.options(Map("delimiter" -> "\t", "header" -> "false"))
.schema("a int, b float")
.load(testFile("test-data/postgresql/agg.data"))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be the root cause of failure.

 java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: jar:file:/home/jenkins/workspace/spark-branch-3.0-test-maven-hadoop-2.7-hive-2.3/sql/core/target/spark-sql_2.12-3.0.1-SNAPSHOT-tests.jar!/test-data/postgresql/agg.data

.createOrReplaceTempView("aggtest")
.write
.format("parquet")
.saveAsTable("aggtest")

session
.read
Expand All @@ -621,7 +630,9 @@ class SQLQueryTestSuite extends QueryTest with SharedSparkSession {
|string4 string
""".stripMargin)
.load(testFile("test-data/postgresql/onek.data"))
.createOrReplaceTempView("onek")
.write
.format("parquet")
.saveAsTable("onek")

session
.read
Expand All @@ -647,14 +658,26 @@ class SQLQueryTestSuite extends QueryTest with SharedSparkSession {
|string4 string
""".stripMargin)
.load(testFile("test-data/postgresql/tenk.data"))
.createOrReplaceTempView("tenk1")
.write
.format("parquet")
.saveAsTable("tenk1")
}

private def removeTestTables(session: SparkSession): Unit = {
session.sql("DROP TABLE IF EXISTS testdata")
session.sql("DROP TABLE IF EXISTS arraydata")
session.sql("DROP TABLE IF EXISTS mapdata")
session.sql("DROP TABLE IF EXISTS aggtest")
session.sql("DROP TABLE IF EXISTS onek")
session.sql("DROP TABLE IF EXISTS tenk1")
}

private val originalTimeZone = TimeZone.getDefault
private val originalLocale = Locale.getDefault

override def beforeAll(): Unit = {
super.beforeAll()
createTestTables(spark)
// Timezone is fixed to America/Los_Angeles for those timezone sensitive tests (timestamp_*)
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"))
// Add Locale setting
Expand All @@ -668,6 +691,7 @@ class SQLQueryTestSuite extends QueryTest with SharedSparkSession {
try {
TimeZone.setDefault(originalTimeZone)
Locale.setDefault(originalLocale)
removeTestTables(spark)

// For debugging dump some statistics about how much time was spent in various optimizer rules
logWarning(RuleExecutor.dumpTimeSpent())
Expand Down