17 Commits
Author SHA1 Message Date
618d5fbe84 GH-47389: [Python] CSV and JSON options lack a nice repr/str (#47397)
### Rationale for this change

CSV and JSON options lack a nice repr/str dunder method

### What changes are included in this PR?

Add both these methods

### Are these changes tested?

Will be once it's ready for review

### Are there any user-facing changes?

No
* GitHub Issue: #47389

Lead-authored-by: Nic Crane <thisisnic@gmail.com>
Co-authored-by: AlenkaF <frim.alenka@gmail.com>
Co-authored-by: Alenka Frim <AlenkaF@users.noreply.github.com>
Signed-off-by: AlenkaF <frim.alenka@gmail.com>
2026-03-25 09:38:36 +01:00
ChiLin ChiuandRaúl Cumplido 992bee2c83 GH-45619: [Python] Use f-string instead of string.format (#45629)
### Rationale for this change

See https://github.com/apache/arrow/issues/45619.

### What changes are included in this PR?

Refactor using f-string instead of `string.format`. But do not use f-string for following case,  `string.format` allows passing parameters, making the code more reusable.

https://github.com/apache/arrow/blob/0fbf9823542233c5f32c26534c34cc97ce3f0be2/python/pyarrow/parquet/core.py#L1624-L1695

### Are these changes tested?

Via CI.

### Are there any user-facing changes?

No.

* GitHub Issue: #45619

Lead-authored-by: Chilin Chiou <chilin.chiou@gmail.com>
Co-authored-by: Raúl Cumplido <raulcumplido@gmail.com>
Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
2025-05-12 14:34:49 +02:00
Xuchen PanandAkshay Subramanian 16c7f1a0bb GH-14932: [Python] Add python bindings for JSON streaming reader (#45084)
### Rationale for this change

The C++ arrow has a JSON streaming reader which is not exposed on the Python interface.

### What changes are included in this PR?

This PR is based on #33761. It adds the `open_json` method to open a streaming reader for a JSON file.

### Are these changes tested?

Yes

### Are there any user-facing changes?

Yes. A new `open_json` method has been added to the Python interface, located at `pyarrow.json.open_json`, and its parameters are the same as the `pyarrow.json.read_json`

* GitHub Issue: #14932

Lead-authored-by: pxc <panxuchen.pxc@alibaba-inc.com>
Co-authored-by: Akshay Subramanian <asubramanian@grailbio.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2025-02-06 14:47:52 +01:00
ca1a0eb2dd GH-37217: [Python] Add missing docstrings to Cython (#37218)
### Rationale for this change

The Cython 3.0.0 upgrade https://github.com/apache/arrow/pull/37097 is triggering numpydoc errors for these missing docstrings.

### What changes are included in this PR?

* Docstrings added to Cython functions that omitted them

### Are these changes tested?

Yes, locally.

### Are there any user-facing changes?

User-facing documentation is added.
* Closes: #37217

Lead-authored-by: Dane Pitkin <dane@voltrondata.com>
Co-authored-by: Dane Pitkin <48041712+danepitkin@users.noreply.github.com>
Co-authored-by: Alenka Frim <AlenkaF@users.noreply.github.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2023-08-18 12:03:28 +09:00
Junming ChenandWeston Pace 49631057e9 GH-34216: [Python] Support for reading JSON Datasets With Python (#34586)
This PR supports for reading JSON Datasets With Python. As mentioned in [#34216](https://github.com/apache/arrow/issues/34216), only the reading ability are supported.

Please compare the difference between my implemenation of _json.pyx, _json.pyd and _csv.pyx _csv.pyd.
Cause _csv.pyd utilize pointer for cpp class and my implementation doesn't. 

**What changes are included in this PR?**

C++: add inclusion for file_json.h
Python: reference C++ codes and support reading JSON Datasets

**Are these changes tested?**
Yes
6 test samples added in tests/test_dataset.py

* Closes: #34216

Lead-authored-by: Junming Chen <junming.chen.r@outlook.com>
Co-authored-by: Weston Pace <weston.pace@gmail.com>
Signed-off-by: Weston Pace <weston.pace@gmail.com>
2023-04-12 15:06:18 -07:00
Marco Edward Gorelli 1706b095d6 GH-31905: [DevTools] Add linting to Cython files (#14662)
* Closes: GH-31905

Authored-by: MarcoGorelli <>
Signed-off-by: Jacob Wujciak-Jens <jacob@wujciak.de>
2023-03-08 23:20:22 +01:00
hankvyang 5c3807b296 ARROW-15939: [Python] Add pickle support for JSON options classes
Use Scenario:

I was using ray.data.read_json to read json data source, in while i got error says that pyarrow.json.ReadOptions & pyarrow.json.ParseOptions does not support pickling so the task could not be passed between workers.

Goal:

Support pickling options class for json.

Closes #12632 from hankvyang/ARROW-15939

Authored-by: hankvyang <hank_yang@sina.cn>
Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
2022-03-17 09:17:04 +01:00
Alessandro Molina 0dfe59223c ARROW-13637: [Python] Fix docstrings
Address all docstrings to make sure they pass `archery numpydoc --allow-rule PR01`

Closes #11245 from amol-/ARROW-13637

Authored-by: Alessandro Molina <amol@turbogears.org>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2021-10-04 11:44:40 +02:00
Alessandro Molina 082b11e9ec ARROW-13239: [Python] [Doc] Expose signatures in pyx modules
Closes #10684 from amol-/ARROW-13239

Authored-by: Alessandro Molina <amol@turbogears.org>
Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
2021-07-16 13:36:54 +02:00
arw2019 78b96de0f8 ARROW-7226: [Python][Doc] Add note re: JSON format support
Closes #8055 from arw2019/ARROW-7226

Authored-by: arw2019 <andrew.r.wieteska@gmail.com>
Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
2020-09-02 14:35:08 +02:00
Antoine Pitrou a4eb08d54e ARROW-9469: [Python] Make more objects weakrefable
By default, Cython extension classes (defined with "cdef class") don't have a weakref slot, so add one to all of them.

This adds just one memory word to each object, which IMHO is acceptable.

Closes #7758 from pitrou/ARROW-9469-py-weakrefable-objects

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Krisztián Szűcs <szucs.krisztian@gmail.com>
2020-07-29 12:24:36 +02:00
Krisztián Szűcs 47931306a4 ARROW-9020: [Python] read_json won't respect explicit_schema in parse_options
Closes #7661 from kszucs/ARROW-9020

Authored-by: Krisztián Szűcs <szucs.krisztian@gmail.com>
Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
2020-07-09 08:41:35 +02:00
Antoine Pitrou 76e61e7b13 ARROW-7237: [C++] Use Result<T> in arrow/json APIs
Closes #7646 from pitrou/ARROW-7237-result-json

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2020-07-07 05:41:47 +09:00
Antoine Pitrou 412145b8a7 ARROW-5757: [Python] Remove Python 2.7 support
Part of the changes were done using [pyupgrade](https://github.com/asottile/pyupgrade).

Closes #6410 from pitrou/ARROW-5757-py2-goodbye and squashes the following commits:

f0f9f513b <Antoine Pitrou> Address review comments
561ac965c <Antoine Pitrou> ARROW-5757:  Remove Python 2.7 support

Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Wes McKinney <wesm+git@apache.org>
2020-02-12 21:37:59 -06:00
Krisztián Szűcs 8bbb297b18 ARROW-6655: [Python] Filesystem bindings for S3
- Add support for S3FileSystem in the python bindings.
- Fixed issue with reading all the content of an S3 object
- Introduce `minio_server` fixture for parametrized testing of all filesystem implementations
- Fixed s3fs parquet test and updated it to use minio_server fixture

Closes #5423 from kszucs/s3 and squashes the following commits:

384c96052 <Krisztián Szűcs> Resolve review comments
73e6625f9 <Krisztián Szűcs> S3Options
98bd91ad1 <Krisztián Szűcs> remove commented tests
db89859ca <Krisztián Szűcs> rename to s3fs
44784582a <Krisztián Szűcs> fix read() issue
c1df10b92 <Krisztián Szűcs> initialization in first use
192ab6547 <Krisztián Szűcs> flake8
f70f9fbd8 <Krisztián Szűcs> remove minio-client dependency
d399643dc <Krisztián Szűcs> simplify test suite
fee57a9a4 <Krisztián Szűcs> remove accidentally committed files
751cfd429 <Krisztián Szűcs> resolve a couple of review comments; enum workaround
45436f7b3 <Krisztián Szűcs> cython flake8
38dcb88d0 <Krisztián Szűcs> rat
c541b3e15 <Krisztián Szűcs> comment left
098048a8a <Krisztián Szűcs> more compat
00340ed4c <Krisztián Szűcs> fixture error handling
2be25ce29 <Krisztián Szűcs> auto initialize s3 on import
88e0c9f79 <Krisztián Szűcs> py2 compat
8585a6085 <Krisztián Szűcs> py2 compat
d37228711 <Krisztián Szűcs> install minio in the conda-toolchain build
041cad42a <Krisztián Szűcs> executable flag
fb0f2813a <Krisztián Szűcs> travis minio install script
8cbe0eeef <Krisztián Szűcs> travis osx
72e56a68f <Krisztián Szűcs> enable S3 in travis python builds
7800c75d8 <Krisztián Szűcs> appveyor flag
7daf5668d <Krisztián Szűcs> fix syntax error in travis script
68eb59161 <Krisztián Szűcs> enable PYARROW_WITH_S3 on appveyor
2cb19d1ff <Krisztián Szűcs> conditional import of test dependencies
efa05d28e <Krisztián Szűcs> use minio for dask.s3fs test too
f25ae5aed <Krisztián Szűcs> travis
9042c7e4c <Krisztián Szűcs> use S3FS_DIR
9ce7180d1 <Krisztián Szűcs> cmake format; fix orc cimport
45a2a17ba <Krisztián Szűcs> docstrings
c0b91621e <Krisztián Szűcs> test requirements; flake8
44aedfd10 <Krisztián Szűcs> stat test
a343950e2 <Krisztián Szűcs> testing suite
1551b525c <Krisztián Szűcs> wip
dd41d21c2 <Krisztián Szűcs> imports
5200af16f <Krisztián Szűcs> s3 filesystem bindings

Authored-by: Krisztián Szűcs <szucs.krisztian@gmail.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2019-10-05 11:47:17 +02:00
Antoine Pitrou ac4a9ef109 ARROW-5556: [Doc] [Python] Document JSON reader
Author: Antoine Pitrou <antoine@python.org>

Closes #4521 from pitrou/ARROW-5556-py-json-docs and squashes the following commits:

40064de97 <Antoine Pitrou> Address review comments
65f357a6b <Antoine Pitrou> ARROW-5556:   Document JSON reader
2019-06-12 10:57:27 -05:00
Philipp Moritz 207b3507be ARROW-5027: [Python] Python bindings for JSON reader
This PR implements Python bindings for the JSON reader.

Author: Philipp Moritz <pcmoritz@gmail.com>

Closes #4044 from pcmoritz/cython-read-json and squashes the following commits:

1148f43ed <Philipp Moritz> update
465e9d416 <Philipp Moritz> fixes and docstring
d75b02d18 <Philipp Moritz> add tests
b630845a7 <Philipp Moritz> temp commit
aa0aa3f85 <Philipp Moritz> update
b1742b00e <Philipp Moritz> update
9dfc978cf <Philipp Moritz> add absolute imports
c776e0f5e <Philipp Moritz> linting
bb614282b <Philipp Moritz> comment in again
46a8561fe <Philipp Moritz> update
619064571 <Philipp Moritz> update
364971c86 <Philipp Moritz> update
90a3510a8 <Philipp Moritz> update
4edb201f6 <Philipp Moritz> initial work on JSON reader python wrapper
2019-05-27 18:01:27 +02:00