-
Notifications
You must be signed in to change notification settings - Fork 4.3k
ARROW-6655: [Python] Filesystem bindings for S3 #5423
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
Changes from all commits
5200af1
dd41d21
1551b52
a343950
44aedfd
c0b9162
45a2a17
9ce7180
9042c7e
f25ae5a
efa05d2
2cb19d1
68eb591
7daf566
7800c75
72e56a6
8cbe0ee
fb0f281
041cad4
d372287
8585a60
88e0c9f
2be25ce
00340ed
098048a
c541b3e
38dcb88
45436f7
751cfd4
fee57a9
d399643
f70f9fb
192ab65
c1df10b
4478458
db89859
98bd91a
73e6625
384c960
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ numpy>=1.14 | |
| pandas | ||
| pytest | ||
| pytest-faulthandler | ||
| pytest-lazy-fixture | ||
| pytz | ||
| setuptools | ||
| setuptools_scm=3.2.0 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| set -e | ||
| set -x | ||
|
|
||
| if [ "$ARROW_TRAVIS_S3" == "1" ]; then | ||
| # Download the Minio S3 server into PATH | ||
| if [ $TRAVIS_OS_NAME = "osx" ]; then | ||
| MINIO_URL=https://dl.min.io/server/minio/release/darwin-amd64/minio | ||
| else | ||
| MINIO_URL=https://dl.min.io/server/minio/release/linux-amd64/minio | ||
| fi | ||
|
|
||
| S3FS_DIR=~/.local/bin/ | ||
| mkdir -p $S3FS_DIR | ||
| wget --directory-prefix $S3FS_DIR $MINIO_URL | ||
| chmod +x $S3FS_DIR/minio | ||
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -100,6 +100,10 @@ CMAKE_COMMON_FLAGS="-DARROW_EXTRA_ERROR_CONTEXT=ON" | |
|
|
||
| PYTHON_CPP_BUILD_TARGETS="arrow_python-all plasma parquet" | ||
|
|
||
| if [ "$ARROW_TRAVIS_S3" == "1" ]; then | ||
| CMAKE_COMMON_FLAGS="$CMAKE_COMMON_FLAGS -DARROW_S3=ON" | ||
| fi | ||
|
|
||
| if [ "$ARROW_TRAVIS_FLIGHT" == "1" ]; then | ||
| CMAKE_COMMON_FLAGS="$CMAKE_COMMON_FLAGS -DARROW_FLIGHT=ON" | ||
| fi | ||
|
|
@@ -164,6 +168,9 @@ export PYARROW_BUILD_TYPE=$ARROW_BUILD_TYPE | |
| export PYARROW_WITH_PARQUET=1 | ||
| export PYARROW_WITH_PLASMA=1 | ||
| export PYARROW_WITH_ORC=1 | ||
| if [ "$ARROW_TRAVIS_S3" == "1" ]; then | ||
| export PYARROW_WITH_S3=1 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm... I suppose there's a leftover here or above?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ARROW_TRAVIS_S3 is still optional, so we need it.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but look at the diff :-)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you mean, have I removed ARROW_TRAVIS_S3 or PYARROW_WITH_S3?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean this:
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :), fixing it |
||
| fi | ||
| if [ "$ARROW_TRAVIS_FLIGHT" == "1" ]; then | ||
| export PYARROW_WITH_FLIGHT=1 | ||
| fi | ||
|
|
@@ -177,6 +184,7 @@ python setup.py develop | |
| python -c "import pyarrow.parquet" | ||
| python -c "import pyarrow.plasma" | ||
| python -c "import pyarrow.orc" | ||
| python -c "import pyarrow.fs" | ||
|
|
||
| # Ensure we do eagerly import pandas (or other expensive imports) | ||
| python < scripts/test_imports.py | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -340,6 +340,12 @@ class ObjectInputFile : public io::RandomAccessFile { | |
| RETURN_NOT_OK(CheckClosed()); | ||
| RETURN_NOT_OK(CheckPosition(position, "read")); | ||
|
|
||
| nbytes = std::min(nbytes, content_length_ - position); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pitrou this is the fix for
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! And thanks for the tests too. |
||
| if (nbytes == 0) { | ||
| *bytes_read = 0; | ||
| return Status::OK(); | ||
| } | ||
|
|
||
| // Read the desired range of bytes | ||
| S3Model::GetObjectResult result; | ||
| RETURN_NOT_OK(GetObjectRange(client_, path_, position, nbytes, &result)); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| # cython: language_level = 3 | ||
|
|
||
| import six | ||
|
|
||
| from pyarrow.compat import frombytes, tobytes | ||
| from pyarrow.includes.common cimport * | ||
| from pyarrow.includes.libarrow cimport PyDateTime_from_TimePoint | ||
| from pyarrow.lib import _detect_compression | ||
| from pyarrow.lib cimport * | ||
|
|
||
|
|
||
| cpdef enum FileType: | ||
| NonExistent = <int8_t> CFileType_NonExistent | ||
| Unknown = <int8_t> CFileType_Unknown | ||
| File = <int8_t> CFileType_File | ||
| Directory = <int8_t> CFileType_Directory | ||
|
|
||
|
|
||
| cdef class FileStats: | ||
| cdef: | ||
| CFileStats stats | ||
|
|
||
| @staticmethod | ||
| cdef FileStats wrap(CFileStats stats) | ||
|
|
||
|
|
||
| cdef class Selector: | ||
| cdef: | ||
| CSelector selector | ||
|
|
||
|
|
||
| cdef class FileSystem: | ||
| cdef: | ||
| shared_ptr[CFileSystem] wrapped | ||
| CFileSystem* fs | ||
|
|
||
| cdef init(self, const shared_ptr[CFileSystem]& wrapped) | ||
|
|
||
|
|
||
| cdef class LocalFileSystem(FileSystem): | ||
| cdef: | ||
| CLocalFileSystem* localfs | ||
|
|
||
| cdef init(self, const shared_ptr[CFileSystem]& wrapped) | ||
|
|
||
|
|
||
| cdef class SubTreeFileSystem(FileSystem): | ||
|
kszucs marked this conversation as resolved.
Outdated
|
||
| cdef: | ||
| CSubTreeFileSystem* subtreefs | ||
|
|
||
| cdef init(self, const shared_ptr[CFileSystem]& wrapped) | ||
Uh oh!
There was an error while loading. Please reload this page.