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


   ### What changes were proposed in this pull request?
   After https://github.com/apache/spark/pull/28527, 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` instead.
   
   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 a table with a location that starts with 
a slash but without a scheme defined, the table will be created under/altered 
to the file system defined in `SessionCatalog.hadoopConf`, instead of the one 
defined in the 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