You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/04/05 10:37:54 UTC

[GitHub] [arrow] raulcd opened a new pull request, #12797: [ARROW-13922] Fix ParquetDataset throw error when len(path_or_paths) == 1

raulcd opened a new pull request, #12797:
URL: https://github.com/apache/arrow/pull/12797

   This PR fixes a bug when a list with a single element was used on `ParquestDataset.read()`.
   
   The following snippet was reported to reproduce the bug:
   
   **Before solution**
   ```python
   In [1]: import pyarrow.parquet as pq
      ...: import pandas as pd
      ...: df = pd.DataFrame({'A': [1, 2, 3], 'B': ['a', 'b', 'c']})
      ...: df.to_parquet('/tmp/test.parquet', index=False)
      ...: pq.ParquetDataset(['/tmp/test.parquet'], use_legacy_dataset=False).read(use_threads=False).to_pandas()
   ---------------------------------------------------------------------------
   ValueError                                Traceback (most recent call last)
   ValueError: cannot construct a FileSource from a path without a FileSystem
   Exception ignored in: 'pyarrow._dataset._make_file_source'
   Traceback (most recent call last):
     File "/home/raulcd/open_source/arrow/python/pyarrow/parquet.py", line 1815, in __init__
       fragment = parquet_format.make_fragment(single_file, filesystem)
   ValueError: cannot construct a FileSource from a path without a FileSystem
   ---------------------------------------------------------------------------
   ```
   
   **After solution**
   ```python
   In [1]: import pyarrow.parquet as pq
      ...: import pandas as pd
      ...: df = pd.DataFrame({'A': [1, 2, 3], 'B': ['a', 'b', 'c']})
      ...: df.to_parquet('/tmp/test.parquet', index=False)
      ...: pq.ParquetDataset(['/tmp/test.parquet'], use_legacy_dataset=False).read(use_threads=False).to_pandas()
   Out[1]: 
      A  B
   0  1  a
   1  2  b
   2  3  c
   
   ```


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] raulcd commented on a diff in pull request #12797: ARROW-13922: [Python] Fix ParquetDataset throw error when len(path_or_paths) == 1

Posted by GitBox <gi...@apache.org>.
raulcd commented on code in PR #12797:
URL: https://github.com/apache/arrow/pull/12797#discussion_r842732031


##########
python/pyarrow/tests/parquet/test_dataset.py:
##########
@@ -639,6 +639,21 @@ def test_read_directory_s3fs(s3_example_s3fs, use_legacy_dataset):
     assert result.equals(table)
 
 
+@pytest.mark.pandas
+@parametrize_legacy_dataset
+def test_read_single_file_list(tempdir, use_legacy_dataset):
+    base_path = str(tempdir)
+    data_path = os.path.join(base_path, 'data.parquet')

Review Comment:
   Thanks! I did not know you could do that. I have added a commit with a change similar to the suggested `data_path = str(tempdir / 'data.parquet')`



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] ursabot commented on pull request #12797: ARROW-13922: [Python] Fix ParquetDataset throw error when len(path_or_paths) == 1

Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #12797:
URL: https://github.com/apache/arrow/pull/12797#issuecomment-1089766142

   Benchmark runs are scheduled for baseline = e92c77564592fadc0d8e6a34964f79d26b9448d4 and contender = 0015561b35f413c4b6c7309f2f86a845860c6e7f. 0015561b35f413c4b6c7309f2f86a845860c6e7f is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Finished :arrow_down:0.0% :arrow_up:0.0%] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/cb9d5a5909e44a56885f2860585c6c6e...6d56d1118f244f498daa0a4d6d941756/)
   [Finished :arrow_down:0.13% :arrow_up:0.0%] [test-mac-arm](https://conbench.ursa.dev/compare/runs/8d04553a6b044419b43bd829ca8e9b15...f2332874be9d4b46a647f3b6d0cb23f2/)
   [Failed :arrow_down:0.36% :arrow_up:0.0%] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/c4827b8bba2249e0b8e5a23c45f6721e...e7acb571893747c8b9d29f2c8734bb56/)
   [Finished :arrow_down:0.09% :arrow_up:0.0%] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/33df057429974cf6a11ea8ad4b4dc314...aa4aa1a1fcaf4911afda0f91ae1148e3/)
   Buildkite builds:
   [Finished] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/447| `0015561b` ec2-t3-xlarge-us-east-2>
   [Finished] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/432| `0015561b` test-mac-arm>
   [Failed] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/433| `0015561b` ursa-i9-9960x>
   [Finished] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/442| `0015561b` ursa-thinkcentre-m75q>
   [Finished] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ec2-t3-xlarge-us-east-2/builds/446| `e92c7756` ec2-t3-xlarge-us-east-2>
   [Finished] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-test-mac-arm/builds/431| `e92c7756` test-mac-arm>
   [Finished] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-i9-9960x/builds/432| `e92c7756` ursa-i9-9960x>
   [Finished] <https://buildkite.com/apache-arrow/arrow-bci-benchmark-on-ursa-thinkcentre-m75q/builds/441| `e92c7756` ursa-thinkcentre-m75q>
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
   test-mac-arm: Supported benchmark langs: C++, Python, R
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] jorisvandenbossche commented on a diff in pull request #12797: ARROW-13922: [Python] Fix ParquetDataset throw error when len(path_or_paths) == 1

Posted by GitBox <gi...@apache.org>.
jorisvandenbossche commented on code in PR #12797:
URL: https://github.com/apache/arrow/pull/12797#discussion_r842682271


##########
python/pyarrow/tests/parquet/test_dataset.py:
##########
@@ -639,6 +639,21 @@ def test_read_directory_s3fs(s3_example_s3fs, use_legacy_dataset):
     assert result.equals(table)
 
 
+@pytest.mark.pandas
+@parametrize_legacy_dataset
+def test_read_single_file_list(tempdir, use_legacy_dataset):
+    base_path = str(tempdir)
+    data_path = os.path.join(base_path, 'data.parquet')

Review Comment:
   ```suggestion
       data_path = str(base_path / 'data.parquet')
   ```
   
   The `tempdir` fixture is a pathlib object, so that allows to write it like the above



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] raulcd commented on a diff in pull request #12797: ARROW-13922: [Python] Fix ParquetDataset throw error when len(path_or_paths) == 1

Posted by GitBox <gi...@apache.org>.
raulcd commented on code in PR #12797:
URL: https://github.com/apache/arrow/pull/12797#discussion_r842732031


##########
python/pyarrow/tests/parquet/test_dataset.py:
##########
@@ -639,6 +639,21 @@ def test_read_directory_s3fs(s3_example_s3fs, use_legacy_dataset):
     assert result.equals(table)
 
 
+@pytest.mark.pandas
+@parametrize_legacy_dataset
+def test_read_single_file_list(tempdir, use_legacy_dataset):
+    base_path = str(tempdir)
+    data_path = os.path.join(base_path, 'data.parquet')

Review Comment:
   Thanks! I did not know you could do that. I have added a commit with a change similar to the suggested `data_path = str(base_path / 'data.parquet')`



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] github-actions[bot] commented on pull request #12797: ARROW-13922: [Python] Fix ParquetDataset throw error when len(path_or_paths) == 1

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #12797:
URL: https://github.com/apache/arrow/pull/12797#issuecomment-1088543279

   https://issues.apache.org/jira/browse/ARROW-13922


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] jorisvandenbossche closed pull request #12797: ARROW-13922: [Python] Fix ParquetDataset throw error when len(path_or_paths) == 1

Posted by GitBox <gi...@apache.org>.
jorisvandenbossche closed pull request #12797: ARROW-13922: [Python] Fix ParquetDataset throw error when len(path_or_paths) == 1
URL: https://github.com/apache/arrow/pull/12797


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] github-actions[bot] commented on pull request #12797: [ARROW-13922] Fix ParquetDataset throw error when len(path_or_paths) == 1

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #12797:
URL: https://github.com/apache/arrow/pull/12797#issuecomment-1088542177

   <!--
     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.
   -->
   
   Thanks for opening a pull request!
   
   If this is not a [minor PR](https://github.com/apache/arrow/blob/master/CONTRIBUTING.md#Minor-Fixes). Could you open an issue for this pull request on JIRA? https://issues.apache.org/jira/browse/ARROW
   
   Opening JIRAs ahead of time contributes to the [Openness](http://theapacheway.com/open/#:~:text=Openness%20allows%20new%20users%20the,must%20happen%20in%20the%20open.) of the Apache Arrow project.
   
   Then could you also rename pull request title in the following format?
   
       ARROW-${JIRA_ID}: [${COMPONENT}] ${SUMMARY}
   
   or
   
       MINOR: [${COMPONENT}] ${SUMMARY}
   
   See also:
   
     * [Other pull requests](https://github.com/apache/arrow/pulls/)
     * [Contribution Guidelines - How to contribute patches](https://arrow.apache.org/docs/developers/contributing.html#how-to-contribute-patches)
   


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow] raulcd closed pull request #12797: ARROW-13922: [Python] Fix ParquetDataset throw error when len(path_or_paths) == 1

Posted by GitBox <gi...@apache.org>.
raulcd closed pull request #12797: ARROW-13922: [Python] Fix ParquetDataset throw error when len(path_or_paths) == 1
URL: https://github.com/apache/arrow/pull/12797


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org