Repository navigation
Conversation
|
Thanks for opening a pull request! If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project. Then could you also rename the pull request title in the following format? or See also: |
f921baf to
db3942b
Compare
|
|
AlenkaF
left a comment
There was a problem hiding this comment.
Thanks for submitting a PR!
From a quick look the test needs a @pytest.mark.pandas mark and some style changes are needed to fix linter errors:
diff --git a/cpp/src/parquet/arrow/writer.cc b/cpp/src/parquet/arrow/writer.cc
index 3724e2edf0..cdaeebc294 100644
--- a/cpp/src/parquet/arrow/writer.cc
+++ b/cpp/src/parquet/arrow/writer.cc
@@ -473,7 +473,9 @@ class FileWriterImpl : public FileWriter {
const WriterProperties& properties() const override { return *writer_->properties(); }
- const ArrowWriterProperties& arrow_properties() const override { return *arrow_properties_; }
+ const ArrowWriterProperties& arrow_properties() const override {
+ return *arrow_properties_;
+ }
::arrow::MemoryPool* memory_pool() const override {
return column_write_context_.memory_pool;
diff --git a/python/pyarrow/_parquet.pyx b/python/pyarrow/_parquet.pyx
index f1287d7b8a..6f3b9a5f[43](https://github.com/apache/arrow/actions/runs/16257450496/job/45897414651?pr=47087#step:5:44) 100644
--- a/python/pyarrow/_parquet.pyx
+++ b/python/pyarrow/_parquet.pyx
@@ -2458,7 +2458,6 @@ cdef class WriterPropertiesWrapper(_Weakrefable):
return self.props.default_column_properties().statistics_enabled()
-
cdef class ArrowWriterPropertiesWrapper(_Weakrefable):
cdef:
shared_ptr[ArrowWriterProperties] props
I will have a look at the proposed code shortly.
db3942b to
23d3161
Compare
23d3161 to
3adfc51
Compare
commented
Jul 15, 2025
|
@AlenkaF thank you, I added |
| df = _test_dataframe(100) | ||
| table = pa.Table.from_pandas(df, preserve_index=False) |
There was a problem hiding this comment.
not specifically related to this PR but would be nice to have an utility function to create an Arrow table directly instead of having to go through pandas. This test doesn't really have to require pandas but the utility function is handy. We can create an issue to move some of those tests to use a new utility function and remove the @pytest.mark.pandas for some of those tests. @AlenkaF what do you think? It could be a good-first-issue
There was a problem hiding this comment.
Agree, adding a new utility function to create Arrow tables and/or batches would be great! And perfect for good-first-issue 👍
There was a problem hiding this comment.
The PR that adds a utility function to create an Arrow table directly (without going through pandas) has been merged. It would be great to use that here now.
There was a problem hiding this comment.
That is not even required. Any hand-created Arrow table, however trivial, would probably be sufficient for this test.
commented
Jul 21, 2025
|
@github-actions crossbow submit -g python -g wheel |
commented
Jul 21, 2025
|
Revision: 3adfc51 Submitted crossbow builds: ursacomputing/crossbow @ actions-623832f922 |
commented
Jul 21, 2025
|
The |
commented
Jul 21, 2025
left a comment
There was a problem hiding this comment.
Sorry for the delay in replying. I think the PR is in great shape — the Cython wrapper classes and properties look good to me. (I considered whether nogil was needed for props_ptr, but since it's just transferring a pointer, I agree it's unnecessary.) The tests are clear, and CI is green, so it's a +1 from me.
I only have one comment regarding the test utility used. Once we get one more approval, I’ll go ahead and merge it.
| df = _test_dataframe(100) | ||
| table = pa.Table.from_pandas(df, preserve_index=False) |
There was a problem hiding this comment.
The PR that adds a utility function to create an Arrow table directly (without going through pandas) has been merged. It would be great to use that here now.
commented
Aug 22, 2025
| return result | ||
|
|
||
|
|
||
| cdef class WriterPropertiesWrapper(_Weakrefable): |
There was a problem hiding this comment.
I'm not familiar with CPython. Does it mean that we only support a subset of attributes from these properties?
There was a problem hiding this comment.
That's correct. The full WriterProperties object is accessible in the Cython code, but the Python wrapper intentionally exposes only a subset.
There was a problem hiding this comment.
Why is that? Is it a convention on the pyarrow side? Isn't it annoying to add a missing property in the future? cc @rok
There was a problem hiding this comment.
@wgtmac I'm not aware is there is a better way. I think generally you expose what the end-users might want to use.
commented
Aug 28, 2025
|
Hey folks, I suggest that if this code passes the sniff test, we merge it and address enhancements in later PRs. |
| return result | ||
|
|
||
|
|
||
| cdef class WriterPropertiesWrapper(_Weakrefable): |
There was a problem hiding this comment.
Why call it "Wrapper"? We should just call it WriterProperties. If that produces a name clash with the C++ class, then we should rename the latter in the Cython declarations to CWriterProperties as we do for many other such cases.
| return self.props.default_column_properties().statistics_enabled() | ||
|
|
||
|
|
||
| cdef class ArrowWriterPropertiesWrapper(_Weakrefable): |
| elif version_int == 1: # V2 | ||
| return "V2" | ||
| else: | ||
| return f"unknown({version_int})" |
There was a problem hiding this comment.
We should probably raise ValueError here?
| cdef init(self, shared_ptr[ArrowWriterProperties] props): | ||
| self.props = props |
There was a problem hiding this comment.
If we're getting a const-ref from the C++ APIs, we should certainly not turn it into a shared_ptr. You should probably let the C++ APIs return a shared_ptr?
| assert props is not None | ||
| assert hasattr(props, 'version') | ||
| assert hasattr(props, 'created_by') | ||
| assert hasattr(props, 'dictionary_enabled') | ||
| assert hasattr(props, 'statistics_enabled') |
There was a problem hiding this comment.
No need for all this, the attribute accesses below are sufficient.
| assert props.version == 2 | ||
| assert props.dictionary_enabled is True | ||
| assert props.statistics_enabled is True | ||
| assert isinstance(props.created_by, str) |
There was a problem hiding this comment.
Why not test the actual value instead of this (or at least some substring of the value)?
| self.props = props | ||
|
|
||
| @property | ||
| def version(self): |
There was a problem hiding this comment.
Please add docstrings for all these properties.
| assert hasattr(props, 'created_by') | ||
| assert hasattr(props, 'dictionary_enabled') | ||
| assert hasattr(props, 'statistics_enabled') | ||
| assert props.version == 2 |
There was a problem hiding this comment.
Not sure what this 2 means... we passed "2.6" above and probably expect to get it back?
commented
Sep 2, 2026
|
Thank you for your contribution. Unfortunately, this pull request has been marked as stale because it has had no activity in the past 365 days. Please remove the stale label or comment below, or this PR will be closed in 14 days. Feel free to re-open this if it has been closed in error. If you do not have repository permissions to reopen the PR, please tag a maintainer. |
commented
Sep 2, 2026
|
@SoundBot would you be interested in continuing this work? |
commented
Oct 30, 2026
|
@rok Should we consider closing this PR and unassign the author from the issue so that anyone interested can pick it up? He hasn't had any GitHub activity since August 2025, so it seems unlikely that the work will be continued. |
commented
Oct 30, 2026
|
@Reranko05 agreed. Let's unassign this issue to allow someone else complete it, but also leave room for @SoundBot to come back and do it in case they have time. |
Rationale for this change
Exposes
ParquetWriterproperties viawriter.propertiesandwriter.arrow_properties(see #45902)
What changes are included in this PR?
See above
Are these changes tested?
Yes
Are there any user-facing changes?
Yes, properties are available via
writer.propertiesandwriter.arrow_properties