-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-37195][SQL][TESTS] Unify v1 and v2 SHOW TBLPROPERTIES tests #34476
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
|
I'm not sure that |
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
MaxGekk
left a comment
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.
L1229 should move to ShowTblPropertiesParserSuite, because it is test Resolve not Parser
@Peng-Lei If you have such tests, please, place them to a separate test suite but not to *ParserSuite. Actually, I planned to do so if I would work on unifying of v1 and v2 CREATE TABLE tests.
|
Test build #144876 has finished for PR 34476 at commit
|
@MaxGekk , Could you continue to look at it, and I made the following modifications
|
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.
Let's leave this suite unchanged.
Today we have a unified framework to resolve database objects in commands, and we don't need to test plan resolution for each command. We will probably clean up this test suite to only test DML commands.
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.
Today we have a unified framework to resolve database objects in commands, and we don't need to test plan resolution for each command.
Thank you for reminding me, you're quite right. I will undo the last modification
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.
done
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #144895 has finished for PR 34476 at commit
|
2806dfd to
95a2266
Compare
|
Kubernetes integration test starting |
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 possible to unify the test? seems this PR just move the old tests to either v1 or v2 test suite, but did not unify them.
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.
|
Kubernetes integration test status failure |
|
Test build #145091 has finished for PR 34476 at commit
|
|
are you going to unify the tests? @Peng-Lei |
Yeah. I am going work on this. Sorry. I clicked the wrong request for review. @cloud-fan |
95a2266 to
a6db08e
Compare
| spark.sql(s"CREATE TABLE $tbl (id bigint, data string) $defaultUsing " + | ||
| s"TBLPROPERTIES ('user'='$user', 'status'='$status')") | ||
|
|
||
| val properties = sql(s"SHOW TBLPROPERTIES $tbl").filter("key != 'transient_lastDdlTime'") |
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.
In order to be compatible Hive table, so add the filter action.
|
|
||
| val properties = sql(s"SHOW TBLPROPERTIES $tbl ('$nonExistingKey')") | ||
| val expected = Seq(Row(nonExistingKey, | ||
| s"Table ns1.tbl does not have property: $nonExistingKey")) |
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.
The table name without catalog name in V1 different with V2.
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.
can we change the test code so that it can be moved to the base class? e.g.
val res = properties.collect()
assert(res.length == 1)
assert(res.head.getString(0) == nonExistingKey)
assert(res.head.getString(1).contains("does not have property: $nonExistingKey"))
| withNamespaceAndTable("ns1", "tbl") { tbl => | ||
| spark.sql(s"CREATE TABLE $tbl (id bigint, data string) $defaultUsing " + | ||
| s"TBLPROPERTIES ('user'='andrew', 'status'='new')") | ||
| withSQLConf(SQLConf.LEGACY_KEEP_COMMAND_OUTPUT_SCHEMA.key -> "true") { |
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.
In V1. We can set LEGACY_KEEP_COMMAND_OUTPUT_SCHEMA to control the output.
|
update as follow:
|
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
| Row("user", user)) | ||
|
|
||
| assert(properties.schema === schema) | ||
| assert(expected === properties.collect().sortBy(_.toString)) |
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.
nit: we can use checkAnswer to check result
|
|
||
| val properties = sql(s"SHOW TBLPROPERTIES $tbl ('status')") | ||
| val expected = Seq(Row("status", status)) | ||
| assert(expected === properties.collect()) |
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.
ditto
| class ShowTblPropertiesSuite extends ShowTblPropertiesSuiteBase with CommandSuiteBase { | ||
| override def commandVersion: String = super[ShowTblPropertiesSuiteBase].commandVersion | ||
|
|
||
| test("SHOW TBLPROPERTIES FOR VIEW") { |
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.
The reason to have these 2 tests here is because hive can return more properties?
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.
if so can we add a comment to explain it?
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.
The reason to have these 2 tests here is because hive can return more properties?
Yeah. An additional attribute transient_lastDdlTime is added for hive. I try to move the test case to v1.base with filter the properties transient_lastDdlTime. So they can run for V1/HIVE V1
cloud-fan
left a comment
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.
LGTM except for some minor comments
|
Test build #145277 has finished for PR 34476 at commit
|
| Row("user", user)) | ||
|
|
||
| assert(properties.schema === schema) | ||
| checkAnswer(properties.sort("key"), 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.
v2: sort the result. v1: without the sort. So the test case sort the result before the compare
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.
v1 should sort as well. We can fix this in a followup.
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #145325 has finished for PR 34476 at commit
|
|
thanks, merging to master! |
What changes were proposed in this pull request?
ShowTblPropertiesParserSuite.command.ShowTblPropertiesSuiteBasethat is parent ofv1.ShowTblPropertiesSuiteBaseandv2.ShowTblPropertiesSuite.v1.ShowTblPropertiesSuiteBasethat is parent ofv1.ShowTblPropertiesSuiteandhive.execution.command.ShowTblPropertiesSuite.DataSourceV2SQLSessionCatalogSuitetocommand.ShowTblPropertiesSuiteBaseto run for V2/V1/HIVE V1HiveCommandSuitetocommand.ShowTblPropertiesSuiteBaseHiveCommandSuitetov1.ShowTblPropertiesSuiteBaseto run for V1/HIVE V1v1.ShowTblPropertiesSuitefor view.The changes follow the approach of #30287 #34305
Why are the changes needed?
SHOW TBLPROPERTIEStests for both DSv1/Hive DSv1 and DSv2Does this PR introduce any user-facing change?
No
How was this patch tested?
By running v1/v2 and Hive v1 ShowTblPropertiesSuite:
$ build/sbt -Phive-2.3 -Phive-thriftserver "test:testOnly *ShowTblPropertiesSuite"