Skip to content

[SPARK-17391] [TEST] [2.0] Fix Two Test Failures After Backport #14951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
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 @@ -77,7 +77,7 @@ class HiveExplainSuite extends QueryTest with SQLTestUtils with TestHiveSingleto
"src")
}

test("SPARK-6212: The EXPLAIN output of CTAS only shows the analyzed plan") {
test("SPARK-17230: The EXPLAIN output of CTAS only shows the analyzed plan") {
Copy link
Contributor

Choose a reason for hiding this comment

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

how did we break this test?

Copy link
Member Author

Choose a reason for hiding this comment

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

When we backporting this PR: #14797 , it breaks the existing test case. It does not correctly work in the master branch. If we do not want to optimize the query of CTAS, we should see SubqueryAlias. Thus, the test case did not fail in the master branch.

withTempView("jt") {
val rdd = sparkContext.parallelize((1 to 10).map(i => s"""{"a":$i, "b":"str$i"}"""))
spark.read.json(rdd).createOrReplaceTempView("jt")
Expand All @@ -98,8 +98,8 @@ class HiveExplainSuite extends QueryTest with SQLTestUtils with TestHiveSingleto
}

val physicalIndex = outputs.indexOf("== Physical Plan ==")
assert(!outputs.substring(physicalIndex).contains("Subquery"),
"Physical Plan should not contain Subquery since it's eliminated by optimizer")
assert(outputs.substring(physicalIndex).contains("SubqueryAlias"),
"Physical Plan should contain SubqueryAlias since the query should not be optimized")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,12 @@ class SQLViewSuite extends QueryTest with SQLTestUtils with TestHiveSingleton {

val catalog = spark.sessionState.catalog
val viewMeta = catalog.getTableMetadata(TableIdentifier("test_view"))
assert(viewMeta.properties("comment") == "test")
assert(viewMeta.comment == Some("test"))
assert(viewMeta.properties("key") == "a")

sql("ALTER VIEW test_view AS SELECT 3 AS i, 4 AS j")
val updatedViewMeta = catalog.getTableMetadata(TableIdentifier("test_view"))
assert(updatedViewMeta.properties("comment") == "test")
assert(updatedViewMeta.comment == Some("test"))
assert(updatedViewMeta.properties("key") == "a")
assert(updatedViewMeta.createTime == viewMeta.createTime)
// The view should be updated.
Expand Down