bozhang2820 opened a new pull request #35462:
URL: https://github.com/apache/spark/pull/35462


   ### What changes were proposed in this pull request?
   This is a follow-up of https://github.com/apache/spark/pull/28527, in which 
we change to create table under the database location when the table location 
is relative. However the criteria to determine if a table location is 
relative/absolute is `URI.isAbsolute`, which basically checks if the table 
location URI has a scheme defined. So table URIs like `/table/path` are treated 
as relative and the scheme and authority of the database location URI are used 
to create the table. For example, when the database location URI is 
`s3a://bucket/db`, the table will be created at `s3a://bucket/table/path`, 
while it should be created under the file system defined in 
`SessionCatalog.hadoopConf`.
   
   This change fixes that by treating table location as absolute when the first 
letter of its path is slash.
   
   This also applies to alter table.
   
   ### Why are the changes needed?
   This is to fix the behavior described above. 
   
   ### Does this PR introduce _any_ user-facing change?
   Yes. When users try to create/alter table with a location that starts with a 
slash but without scheme defined, the table will be created under / altered to 
the file system defined in `SessionCatalog.hadoopConf`, instead of the one 
defined in database location URI.
   
   ### How was this patch tested?
   Updated unit tests.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to