Skip to content
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

[SPARK-28757][SQL] File table location should include both values of option path and paths #25473

Closed
wants to merge 1 commit into from

Conversation

gengliangwang
Copy link
Member

@gengliangwang gengliangwang commented Aug 16, 2019

What changes were proposed in this pull request?

If both options path and paths are passed to file data source v2, both values of the options should be included as the target paths.

Why are the changes needed?

In V1 implementation, file table location includes both values of option path and paths.
In the refactoring of #24025, the value of option path is ignored if "paths" are specified. We should make it consistent with V1.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Unit test

@gengliangwang
Copy link
Member Author

@cloud-fan

@SparkQA
Copy link

SparkQA commented Aug 16, 2019

Test build #109206 has finished for PR 25473 at commit 47854e8.

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

@@ -43,11 +43,10 @@ trait FileDataSourceV2 extends TableProvider with DataSourceRegister {

protected def getPaths(map: CaseInsensitiveStringMap): Seq[String] = {
val objectMapper = new ObjectMapper()
Option(map.get("paths")).map { pathStr =>
val paths = Option(map.get("paths")).map { pathStr =>
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: you can convert the option to a Seq, so you don't need to the getOrElse call.

Copy link
Member Author

@gengliangwang gengliangwang Aug 16, 2019

Choose a reason for hiding this comment

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

The result of .map { pathStr => objectMapper.readValue(pathStr, classOf[Array[String]]).toSeq is Option[Seq[String]]. I think the getOrElse is fine here.

Copy link
Contributor

@hvanhovell hvanhovell left a comment

Choose a reason for hiding this comment

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

LGTM (FWIW)

@cloud-fan
Copy link
Contributor

thanks, merging to master!

@cloud-fan cloud-fan closed this in 92bfd9a Aug 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants