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-51182][SQL] DataFrameWriter should throw dataPathNotSpecifiedError when path is not specified #49928

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/pkg/tests/fulltests/test_sparkSQL.R
Original file line number Diff line number Diff line change
Expand Up @@ -4000,7 +4000,7 @@ test_that("Call DataFrameWriter.save() API in Java without path and check argume
# DataFrameWriter.save() without path.
expect_error(write.df(df, source = "csv"),
paste("Error in save : org.apache.spark.SparkIllegalArgumentException:",
"Expected exactly one path to be specified"))
"'path' is not specified."))
expect_error(write.json(df, jsonPath),
"Error in json : analysis error - \\[PATH_ALREADY_EXISTS\\].*")
expect_error(write.text(df, jsonPath),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,10 @@ case class DataSource(
val allPaths = paths ++ caseInsensitiveOptions.get("path")
val outputPath = if (allPaths.length == 1) {
makeQualified(new Path(allPaths.head))
} else {
} else if (allPaths.length > 1) {
throw QueryExecutionErrors.multiplePathsSpecifiedError(allPaths)
} else {
throw QueryExecutionErrors.dataPathNotSpecifiedError()
}

val caseSensitive = sparkSession.sessionState.conf.caseSensitiveAnalysis
Expand Down