-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-33426][SQL][TESTS] Unify Hive SHOW TABLES tests #30340
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
Conversation
|
@cloud-fan @HyukjinKwon Could you take a look at this PR, please. |
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
Test build #130947 has finished for PR 30340 at commit
|
| override protected val spark: SparkSession = TestHive.sparkSession | ||
| protected override def beforeAll(): Unit = {} | ||
|
|
||
| test("show Hive tables") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it specific to hive tables? if not we should put it in the base trait.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not. The difference is probably in omitting explicit USING HIVE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's not something SHOW TABLES should care about. Let's simply add a test in the base trait for complex patterns and this suite just extends the base trait.
| "SHOW TABLES IN default 'show1*'", | ||
| ShowRow("default", "show1a", false) :: Nil) | ||
| runShowTablesSql( | ||
| "SHOW TABLES IN default 'show1*|show2*'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the only place that improves test coverage. Maybe we should just add one more test in the base trait to test complicated patterns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeh, it seems only this test case brings some benefits. Let me move it the common trait, and remove all those duplicate checks.
| } | ||
|
|
||
| test("show tables with a pattern") { | ||
| withNamespace(s"$catalog.ns1", s"$catalog.ns2") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ns2 is not used in the test actually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will revert ns2 back to check that tables from the namespace are not showed.
| val df = spark.sql(sqlText) | ||
| assert(df.schema === showSchema) | ||
| assert(df.collect() === getRows(expected)) | ||
| assert(df.collect().toSet === getRows(expected).toSet) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After modifications in show tables with a pattern, the order of rows was changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about checkAnswer(df, getRows(expected))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced it by checkAnswer()
|
Test build #130978 has finished for PR 30340 at commit
|
|
Kubernetes integration test starting |
| override def version: String = "Hive V1" | ||
| override def defaultUsing: String = "USING HIVE" | ||
| override protected val spark: SparkSession = TestHive.sparkSession | ||
| protected override def beforeAll(): Unit = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to override this otherwise tests failed with:
SHOW TABLES Hive V1: change current catalog and namespace with USE statements *** FAILED *** (17 milliseconds)
[info] java.lang.IllegalStateException: LiveListenerBus is stopped.
[info] at org.apache.spark.scheduler.LiveListenerBus.addToQueue(LiveListenerBus.scala:97)
[info] at org.apache.spark.scheduler.LiveListenerBus.addToStatusQueue(LiveListenerBus.scala:80)
...
[info] Cause: java.lang.IllegalStateException: LiveListenerBus is stopped.
[info] at org.apache.spark.scheduler.LiveListenerBus.addToQueue(LiveListenerBus.scala:97)
[info] at org.apache.spark.scheduler.LiveListenerBus.addToStatusQueue(LiveListenerBus.scala:80)
[info] at org.apache.spark.sql.internal.SharedState.<init>(SharedState.scala:103)
[info] at org.apache.spark.sql.hive.test.TestHiveSharedState.<init>(TestHive.scala:99)
[info] at org.apache.spark.sql.hive.test.TestHiveSparkSession.$anonfun$sharedState$1(TestHive.scala:222)
[info] at scala.Option.getOrElse(Option.scala:189)
[info] at org.apache.spark.sql.hive.test.TestHiveSparkSession.sharedState$lzycompute(TestHive.scala:222)
[info] at org.apache.spark.sql.hive.test.TestHiveSparkSession.sharedState(TestHive.scala:221)
[info] at org.apache.spark.sql.hive.test.TestHiveSparkSession.sharedState(TestHive.scala:174)
[info] at org.apache.spark.sql.internal.BaseSessionStateBuilder.build(BaseSessionStateBuilder.scala:333)
[info] at org.apache.spark.sql.hive.test.TestHiveSparkSession.sessionState$lzycompute(TestHive.scala:227)
[info] at org.apache.spark.sql.hive.test.TestHiveSparkSession.sessionState(TestHive.scala:226)
[info] at org.apache.spark.sql.hive.test.TestHiveSparkSession.$anonfun$sql$1(TestHive.scala:240)
[info] at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:768)
[info] at org.apache.spark.sql.hive.test.TestHiveSparkSession.sql(TestHive.scala:239)
| class ShowTablesSuite extends v1.ShowTablesSuite { | ||
| override def version: String = "Hive V1" | ||
| override def defaultUsing: String = "USING HIVE" | ||
| override protected val spark: SparkSession = TestHive.sparkSession |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could take this from TestHiveSingleton but when I mix the trait:
[error] /Users/maximgekk/proj/show-tables-hive-tests/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/command/ShowTablesSuite.scala:24:7: class ShowTablesSuite inherits conflicting members:
[error] method spark in trait SharedSparkSessionBase of type => org.apache.spark.sql.SparkSession and
[error] value spark in trait TestHiveSingleton of type org.apache.spark.sql.SparkSession
[error] (Note: this can be resolved by declaring an override in class ShowTablesSuite.)
[error] class ShowTablesSuite extends v1.ShowTablesSuite with TestHiveSingleton {
[error] ^
[error] one error found
|
Kubernetes integration test status success |
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
Test build #130984 has finished for PR 30340 at commit
|
|
Kubernetes integration test starting |
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Kubernetes integration test status success |
|
Test build #130991 has finished for PR 30340 at commit
|
|
Test build #130994 has finished for PR 30340 at commit
|
|
retest this please |
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
Test build #131015 has finished for PR 30340 at commit
|
|
thanks, merging to master! |
What changes were proposed in this pull request?
org.apache.spark.sql.hive.execution.command.ShowTablesSuite.'table_name_1*|table_name_2*'in the common test suite.Why are the changes needed?
To test V1 + common SHOW TABLES tests in Hive.
Does this PR introduce any user-facing change?
No
How was this patch tested?
By running v1/v2 and Hive v1
ShowTablesSuite: