-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-15269][SQL] Set provided path to CatalogTable.storage.locationURI when creating external non-hive compatible table #13120
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
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ee1d21d
spark-15206 add testcases for distinct aggregate in having clause fol…
xwu0226 720cc72
Revert "spark-15206 add testcases for distinct aggregate in having cl…
xwu0226 c3027a1
SPARK-15269: set locationUFI to the non-hive compatible metastore table
xwu0226 f13bf6e
SPARK-15269: only for external datasource table
xwu0226 017f172
SPARK-15269: addresses review comments
xwu0226 1c903d2
SPARK-15269: code style
xwu0226 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
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.
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.
The following line should be enough for
localtionUri:Consider the following directory layout containing two Parquet files:
If we pass "/tmp/dir/part-00001.parquet" as file path, the logic above will use the "/tmp/dir/" as
locationUri, thus "part-00002.parquet" is also included, which is not the expected behavior.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.
@liancheng Thanks! I tried this before, but hive complained that the path is either not a directory or it can not create one with the path.. This was the reason it failed the testcases in
MetastoreDataSourcesSuite, wherever we create a datasource (non-hive compatible) table with an exact file name. Example:I also tried in hive shell:
So it seems hive only takes a directory as table location. In our case, we need to give hive a directory via
locationURI.For your concern of having a directory containing multiple files, in this case, we are in the non-hive compatible code path, do we still expect the consistency between hive and spark sql? Querying from spark sql will return expected results. while the results will be different from hive. But current behavior of non-hive compatible table is like this already.
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.
Hm... Then I think we probably should save the path as a SerDe property (similar to schema of persisted data source tables). @yhuai How do you think? It breaks existing functionality if we can't read individual files.
Uh oh!
There was an error while loading. Please reload this page.
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.
The full path is already populated in the SerDe Property with the
options, see lines. The select will still work from spark sql becauseHiveMetastoreCatalog.lookupRelationusescachedDataSourceTablesthat loads the persisted data source table with theoptions = CatalogTable.storage.serdePropertiesandDataSource.resolveRelationtakesoptions.get("path")for the relation's file location. SeeThere 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.
(For future reference, the above comment is replied here.)