Skip to content

[SPARK-30673][SQL][TESTS] Test cases in HiveShowCreateTableSuite should create Hive table#27393

Closed
viirya wants to merge 4 commits intoapache:masterfrom
viirya:SPARK-30673
Closed

[SPARK-30673][SQL][TESTS] Test cases in HiveShowCreateTableSuite should create Hive table#27393
viirya wants to merge 4 commits intoapache:masterfrom
viirya:SPARK-30673

Conversation

@viirya
Copy link
Copy Markdown
Member

@viirya viirya commented Jan 30, 2020

What changes were proposed in this pull request?

This patch makes the test cases in HiveShowCreateTableSuite create Hive table instead of data source table.

Why are the changes needed?

Because SparkSQL now creates data source table if no provider is specified in SQL command, some test cases in HiveShowCreateTableSuite don't create Hive table, but data source table.

It is confusing and not good for the purpose of this test suite.

Does this PR introduce any user-facing change?

No, only test case.

How was this patch tested?

Unit test.

@viirya
Copy link
Copy Markdown
Member Author

viirya commented Jan 30, 2020

I found that few test cases in HiveShowCreateTableSuite behave differently and actually create datasource table, when I want to sync #24938 with master. So this patch updates them.

@viirya
Copy link
Copy Markdown
Member Author

viirya commented Jan 30, 2020

cc @dongjoon-hyun @cloud-fan

@dongjoon-hyun
Copy link
Copy Markdown
Member

Thank you for pinging me, @viirya .

Copy link
Copy Markdown
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, LGTM (Pending Jenkins).

@viirya
Copy link
Copy Markdown
Member Author

viirya commented Jan 30, 2020

Thanks! @dongjoon-hyun

@SparkQA
Copy link
Copy Markdown

SparkQA commented Jan 30, 2020

Test build #117544 has finished for PR 27393 at commit 936b574.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link
Copy Markdown

SparkQA commented Jan 30, 2020

Test build #117547 has finished for PR 27393 at commit feb4913.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongjoon-hyun
Copy link
Copy Markdown
Member

Retest this please.

@HyukjinKwon HyukjinKwon changed the title [SPARK-30673][SQL][Test] Test cases in HiveShowCreateTableSuite should create Hive table [SPARK-30673][SQL][TESTS] Test cases in HiveShowCreateTableSuite should create Hive table Jan 30, 2020
withSQLConf(
SQLConf.LEGACY_CREATE_HIVE_TABLE_BY_DEFAULT_ENABLED.key -> "true") {
withTable("t1") {
val createTable = "CREATE TABLE `t1`(`a` STRUCT<`b`: STRING>) USING hive"
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.

Hm, doesn't this already creates a Hive table?

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.

Actually, I asked to cover all cases to avoid future parser changes at the other test cases (partitioned table), but @HyukjinKwon 's comment also makes sense at this case. @viirya . Sorry, you can omit these two cases.

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.

Oops, I missed that comment. What about we do it in beforeAll o beforeEach? I left a comment because it enables it for each test manually and it looked odd to do it for unnecessary cases as well.

| c1 INT COMMENT 'bla',
| c2 STRING
|)
|STORED AS PARQUET
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.

@viirya, does this test also need to enable the configuration? I thought 58be82a changed the default provider when provider isn't specified

@SparkQA
Copy link
Copy Markdown

SparkQA commented Jan 30, 2020

Test build #117553 has finished for PR 27393 at commit feb4913.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

test("simple external hive table") {
withTempDir { dir =>
withSQLConf(
SQLConf.LEGACY_CREATE_HIVE_TABLE_BY_DEFAULT_ENABLED.key -> "true") {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

legacy configs may get removed in future versions. Can we update the testing query to add USING hive or STORE AS TEXT?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There is a test simple hive table. The purpose of the test should be a very simple CREATE TABLE query. My original proposal is just to add legacy config enabled for few tests like this one.

Adding USING hive is ok, I'm just concerned that it will reduce test coverage.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think as @HyukjinKwon said we can use beforeAll. WDYT?

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.

+1 for beforeAll.

Copy link
Copy Markdown
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, LGTM.

@SparkQA
Copy link
Copy Markdown

SparkQA commented Jan 30, 2020

Test build #117575 has finished for PR 27393 at commit e97601e.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link
Copy Markdown

SparkQA commented Jan 30, 2020

Test build #117576 has finished for PR 27393 at commit 15bbf4e.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@viirya
Copy link
Copy Markdown
Member Author

viirya commented Jan 30, 2020

Thanks! I'm going to merge this.

@viirya viirya closed this in 5916c7d Jan 30, 2020
@viirya
Copy link
Copy Markdown
Member Author

viirya commented Jan 30, 2020

Merged into master.

@viirya viirya deleted the SPARK-30673 branch December 27, 2023 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants