-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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-32815][ML][2.4] Fix LibSVM data source loading error on file paths with glob metacharacters #29678
Closed
MaxGekk
wants to merge
7
commits into
apache:branch-2.4
from
MaxGekk:globbing-paths-when-inferring-schema-ml-2.4
Closed
[SPARK-32815][ML][2.4] Fix LibSVM data source loading error on file paths with glob metacharacters #29678
MaxGekk
wants to merge
7
commits into
apache:branch-2.4
from
MaxGekk:globbing-paths-when-inferring-schema-ml-2.4
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… case of path with glob metacharacters.
MaxGekk
commented
Sep 8, 2020
@@ -184,4 +184,22 @@ class LibSVMRelationSuite extends SparkFunSuite with MLlibTestSparkContext { | |||
spark.sql("DROP TABLE IF EXISTS libsvmTable") | |||
} | |||
} | |||
|
|||
test("SPARK-32815: Test LibSVM data source on file paths with glob metacharacters") { | |||
val basePath = Utils.createDirectory(tempDir.getCanonicalPath, "globbing") |
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.
Here is the diff with the patch for 3.0 because withTempDir is not available in 2.4 here:
https://github.com/apache/spark/pull/29675/files#diff-ed6960b663c36ea39eee8c20aae09fb3R196
Test build #128399 has finished for PR 29678 at commit
|
thanks, merging to 2.4! |
cloud-fan
pushed a commit
that referenced
this pull request
Sep 8, 2020
…aths with glob metacharacters ### What changes were proposed in this pull request? In the PR, I propose to fix an issue with LibSVM datasource when both of the following are true: * no user specified schema * some file paths contain escaped glob metacharacters, such as `[``]`, `{``}`, `*` etc. The fix is a backport of #29675, and it is based on another bug fix for CSV/JSON datasources #29663. ### Why are the changes needed? To fix the issue when the follow two queries try to read from paths `[abc]`: ```scala spark.read.format("libsvm").load("""/tmp/\[abc\].csv""").show ``` but would end up hitting an exception: ``` Path does not exist: file:/private/var/folders/p3/dfs6mf655d7fnjrsjvldh0tc0000gn/T/spark-6ef0ae5e-ff9f-4c4f-9ff4-0db3ee1f6a82/[abc]/part-00000-26406ab9-4e56-45fd-a25a-491c18a05e76-c000.libsvm; org.apache.spark.sql.AnalysisException: Path does not exist: file:/private/var/folders/p3/dfs6mf655d7fnjrsjvldh0tc0000gn/T/spark-6ef0ae5e-ff9f-4c4f-9ff4-0db3ee1f6a82/[abc]/part-00000-26406ab9-4e56-45fd-a25a-491c18a05e76-c000.libsvm; at org.apache.spark.sql.execution.datasources.DataSource$.$anonfun$checkAndGlobPathIfNecessary$3(DataSource.scala:770) at org.apache.spark.util.ThreadUtils$.$anonfun$parmap$2(ThreadUtils.scala:373) at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:659) at scala.util.Success.$anonfun$map$1(Try.scala:255) at scala.util.Success.map(Try.scala:213) ``` ### Does this PR introduce _any_ user-facing change? Yes ### How was this patch tested? Added UT to `LibSVMRelationSuite`. Closes #29678 from MaxGekk/globbing-paths-when-inferring-schema-ml-2.4. Authored-by: Max Gekk <max.gekk@gmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
In the PR, I propose to fix an issue with LibSVM datasource when both of the following are true:
[``]
,{``}
,*
etc.The fix is a backport of #29675, and it is based on another bug fix for CSV/JSON datasources #29663.
Why are the changes needed?
To fix the issue when the follow two queries try to read from paths
[abc]
:but would end up hitting an exception:
Does this PR introduce any user-facing change?
Yes
How was this patch tested?
Added UT to
LibSVMRelationSuite
.