-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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-37546][SQL] V2 ReplaceTableAsSelect command should qualify location #34807
Conversation
cc @imback82 |
Kubernetes integration test starting |
Kubernetes integration test status failure |
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 if tests pass. Thanks @huaxingao!
Test build #145923 has finished for PR 34807 at commit
|
Kubernetes integration test starting |
Kubernetes integration test status failure |
Test build #145926 has finished for PR 34807 at commit
|
.filter("col_name = 'Location'") | ||
.select("data_type").head.getString(0) | ||
assert(location === "file:/tmp/foo") | ||
assert(location1 === "file:/tmp/foo") | ||
spark.sql(s"REPLACE TABLE $identifier USING foo LOCATION '/tmp/foo' " + |
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 add a new test case? In the future I believe we will have separate test suites for CREATE and REPLACE TABLE and we need separate test cases anyway.
@@ -165,9 +165,10 @@ class DataSourceV2Strategy(session: SparkSession) extends Strategy with Predicat | |||
|
|||
case CreateTable(ResolvedDBObjectName(catalog, ident), schema, partitioning, | |||
tableSpec, ifNotExists) => | |||
val qualifiedLocation = tableSpec.location.map(makeQualifiedDBObjectPath(_)) | |||
val tableSpecWithQualifiedLocation = tableSpec.copy( |
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.
shall we add a new method qualifyLocInTableSpec(tableSpec): TableSpec
to simplify the code here and other places?
Kubernetes integration test starting |
Kubernetes integration test status failure |
thanks, merging to master! |
Test build #145944 has finished for PR 34807 at commit
|
Test build #145943 has finished for PR 34807 at commit
|
Thanks! @cloud-fan @imback82 |
What changes were proposed in this pull request?
Currently, v2 RTAS command doesn't qualify the location:
, whereas v1 command qualifies the location as file:/tmp/foo which is the correct behavior since the default filesystem can change for different sessions.
Why are the changes needed?
This PR proposes to store the qualified location in order to prevent the issue where default filesystem changes for different sessions.
Does this PR introduce any user-facing change?
Yes, now, v2 RTAS command will store qualified location:
How was this patch tested?
new test