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

ARROW-7058: [C++] FileSystemDataSourceDiscovery should apply partition schemes relative to its base dir #5772

Closed
wants to merge 3 commits into from

Conversation

bkietz
Copy link
Member

@bkietz bkietz commented Nov 4, 2019

@bkietz bkietz requested a review from fsaintjacques November 4, 2019 20:33
@github-actions
Copy link

github-actions bot commented Nov 4, 2019

Copy link
Contributor

@fsaintjacques fsaintjacques left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From an API perspective, this is the wrong approach. The caller can't disable this non-trivially (passing a selector with an empty base is... an implementation detail hack) and forces the caller to always pass a Selector even if there's none, e.g how can the user pass just an explicit list of FileStats?

This should live in PartitionScheme, independent of DataSourceDiscovery, Either via a prefix optional parameter or a composed StripBasePartitionScheme(child_scheme, prefix) if you don't want to add the prefix to all relevant schemes.

@nealrichardson any idea on how to make this ergonomic?

@fsaintjacques fsaintjacques changed the title ARROW-7058: [C++] FilSystemDataSourceDiscovery should apply partition schemes relative to its base dir ARROW-7058: [C++] FileSystemDataSourceDiscovery should apply partition schemes relative to its base dir Nov 5, 2019
@nealrichardson
Copy link
Member

IDK about C++ API ergonomics, I just know what the expected behavior should be. If I tell you my dataset is in /home/username/data/taxi, and it's partitioned in directories year, month, day, we should interpret that to mean relative to the dataset root directory, not the root of the file system. I can't think of any reason why I would want something other than that, so I don't see value in having a C++ API that makes me do extra work to avoid doing something illogical.

for (const auto& file : files) {
const auto& path = file.path();
if (file.path().substr(0, base_dir.size()) != base_dir) continue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to decide what should be the most friendly behavior in such case. I'd tempted to vote for parse without trimming instead of skipping the file.

std::string path = file.path();
if (!base_dir.empty() && path.substr(0, base_dir.size()) == base_dir) {
  path = path.substr(base_dir.size());
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parsing some paths with a known prefix removed and other paths with an unknown prefix seems like a foot gun to me. I'd expect the files which lie outside base_dir to be picked up with a different instance of Discovery (with the correct base_dir for those files).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Ben. If I'm supplying my own file paths, and some are relative to the given "base_dir" and some aren't, (1) the simple partition scheme of applying a schema to path segments probably won't just work across all of them if they don't share a base_dir, and if I want to use it I should put them in different Discovery instances; and (2) if we tried to get partition info from files outside of base_dir, it will probably error in parsing the path segments, so continue and not assign partition data to that file is probably safest.

kszucs added a commit to kszucs/arrow that referenced this pull request Nov 6, 2019
* ARROW-7067: [CI] Disable code coverage on Travis-CI

Closes apache#5778 from pitrou/ARROW-7067-travis-disable-coverage and squashes the following commits:

bda5ff4 <Antoine Pitrou> ARROW-7067:  Disable code coverage on Travis-CI

Authored-by: Antoine Pitrou <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>

* ARROW-7058: [C++] FileSystemDataSourceDiscovery should apply partition schemes relative to its base dir

@nealrichardson

Closes apache#5772 from bkietz/7058-FileSystemDataSourceDisco and squashes the following commits:

c0edfa5 <Benjamin Kietzman> make base_dir of partition schemes explicitly optional
f2f9689 <Benjamin Kietzman> add DCHECK for path containing selector
1bae5ff <Benjamin Kietzman> ARROW-7058:  FilSystemDataSourceDiscovery should apply partition schemes relative to its base dir

Authored-by: Benjamin Kietzman <[email protected]>
Signed-off-by: François Saint-Jacques <[email protected]>

* Refactor docker-compose file and use it with github actions.

* Turn off gandiva and flight for the HDFS test [skip ci]

* Missing --pyargs argument for the python test command [skip ci]

* Add CentOS version to the manylinux image names [skip ci]

* Fix manylinux volumes [skip ci]
@bkietz bkietz deleted the 7058-FileSystemDataSourceDisco branch February 25, 2021 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants