-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-28595][SQL] explain should not trigger partition listing #25328
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,6 +49,16 @@ class BucketedReadWithoutHiveSupportSuite extends BucketedReadSuite with SharedS | |
| abstract class BucketedReadSuite extends QueryTest with SQLTestUtils { | ||
| import testImplicits._ | ||
|
|
||
| protected override def beforeAll(): Unit = { | ||
| super.beforeAll() | ||
| spark.sessionState.conf.setConf(SQLConf.LEGACY_BUCKETED_TABLE_SCAN_OUTPUT_ORDERING, true) | ||
| } | ||
|
|
||
| protected override def afterAll(): Unit = { | ||
| spark.sessionState.conf.unsetConf(SQLConf.LEGACY_BUCKETED_TABLE_SCAN_OUTPUT_ORDERING) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we do a "store and recover the old conf" instead?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the test, we assume that every test suite will keep the shared |
||
| super.afterAll() | ||
| } | ||
|
|
||
| private val maxI = 5 | ||
| private val maxJ = 13 | ||
| private lazy val df = (0 until 50).map(i => (i % maxI, i % maxJ, i.toString)).toDF("i", "j", "k") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,12 +17,12 @@ | |
|
|
||
| package org.apache.spark.sql.hive.execution | ||
|
|
||
| import org.apache.spark.metrics.source.HiveCatalogMetrics | ||
| import org.apache.spark.sql.QueryTest | ||
| import org.apache.spark.sql.catalyst.TableIdentifier | ||
| import org.apache.spark.sql.catalyst.parser.ParseException | ||
| import org.apache.spark.sql.execution.datasources.InsertIntoHadoopFsRelationCommand | ||
| import org.apache.spark.sql.hive.HiveUtils | ||
| import org.apache.spark.sql.hive.execution._ | ||
| import org.apache.spark.sql.hive.test.TestHiveSingleton | ||
| import org.apache.spark.sql.internal.SQLConf | ||
| import org.apache.spark.sql.test.SQLTestUtils | ||
|
|
@@ -32,7 +32,6 @@ import org.apache.spark.util.Utils | |
| * A set of tests that validates support for Hive Explain command. | ||
| */ | ||
| class HiveExplainSuite extends QueryTest with SQLTestUtils with TestHiveSingleton { | ||
| import testImplicits._ | ||
|
|
||
| test("show cost in explain command") { | ||
| val explainCostCommand = "EXPLAIN COST SELECT * FROM src" | ||
|
|
@@ -207,4 +206,14 @@ class HiveExplainSuite extends QueryTest with SQLTestUtils with TestHiveSingleto | |
| } | ||
| } | ||
| } | ||
|
|
||
| test("SPARK-28595: explain should not trigger partition listing") { | ||
| HiveCatalogMetrics.reset() | ||
| withTable("t") { | ||
| sql("CREATE TABLE t USING json PARTITIONED BY (j) AS SELECT 1 i, 2 j") | ||
| assert(HiveCatalogMetrics.METRIC_PARTITIONS_FETCHED.getCount == 0) | ||
| spark.table("t").explain() | ||
| assert(HiveCatalogMetrics.METRIC_PARTITIONS_FETCHED.getCount == 0) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a test case that can return non-zero when |
||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.