Repository navigation
GH-26153: [C++] Share common codes for RecordBatchStreamReader and StreamDecoder - #36344
Conversation
There was a problem hiding this comment.
We may want to use better name for a vector of metadata...
482e471 to
5fd2145
Compare
There was a problem hiding this comment.
https://github.com/apache/arrow/pull/36344/files#diff-e992169684aea9845ac776ada4cbb2b5dc711b49e5a3fbc6046c92299e1aefceR940 and https://github.com/apache/arrow/pull/36344/files#diff-e992169684aea9845ac776ada4cbb2b5dc711b49e5a3fbc6046c92299e1aefceR954 .
(I understand that this PR's diff is difficult to review...)
There was a problem hiding this comment.
Ahh... Isn't it error-prone that schema() returns the filtered schema (out_schema_) but OnSchemaDecoded is called with the unfiltered schema (schema_)?
There was a problem hiding this comment.
I can understand your concern.
How about adding Listener::OnSchemaDecoded(std::shared_ptr<Schema> schema, std::shared_ptr<Schema> filtered_schema) and it calls Listener::OnSchemaDecoded(std::shared_ptr<Schema> schema) by default for keeping backward compatibility? (Is filtered_schema name good? I think that out_schema is difficult to understand.)
If we want to do it, I want to do it in a separated pull request instead of including it to this pull request. Because it's not related to this pull request.
There was a problem hiding this comment.
That's a good idea, thanks for suggesting it.
|
The integration test failures seems related: |
|
The integration test failures are fixed. |
|
It seems like Homebrew is broken currently? @kou Edit: it seems to feel better now. |
d6f1948 to
b46f6a7
Compare
I've fixed it by #36403 and rebased on main. |
|
AppVeyor failure: #36405 |
|
The R failures look unexpected. @paleolimbot @thisisnic Any clue about them? |
|
R failures are unrelated; the fix is in #36397 |
…and StreamDecoder Because they (pull-based and push-based) must have the same behavior. This PR extracts reusable codes to StreamDecoderInternal from StreamDecoderImpl. External API isn't changed for RecordBatchStreamReader and StreamDecoder. This PR adds some external API to implement this: * arrow::Status::ToStringWithoutContextLines(): This is only for testing. We can get stable result of ASSERT_RAISES_WITH_MESSAGE() with/without -DARROW_EXTRA_ERROR_CONTEXT=ON by this. We can extract this and related changes to separated PR if we want. * arrow::ipc::Listener::OnRecordBatchWithMetadataDecoded(): Because RecordBatchStreamReader wants not only RecordBatch but also custom metadata. OnRecordBatchWithMetadataDecoded() receives RecordBatchWithMetadata. OnRecordBatchDecoded() still exists and it's used by default for backward compatibility. * arrow::ipc::CollectListener::metadatas(), arrow::ipc::CollectListener::num_record_batches(), arrow::ipc::CollectListener::PopRecordBatch(), arrow::ipc::CollectListener::PopRecordBatchWithMetadat(): If we add these APIs, we can use CollectListner in RecordBatchStreamReader. We can create an internal listener only for RecordBatchStreamReader if don't want to extend CollectListener.
Co-authored-by: Antoine Pitrou <[email protected]>
Co-authored-by: Antoine Pitrou <[email protected]>
b46f6a7 to
9e1ca8d
Compare
|
#36397 was merged and I've rebased on main. |
|
The R failures have gone. |
|
Conbench analyzed the 6 benchmark runs on commit There were 3 benchmark results indicating a performance regression:
The full Conbench report has more details. |
Rationale for this change
Because they (pull-based and push-based) must have the same behavior.
What changes are included in this PR?
This PR extracts reusable codes to StreamDecoderInternal from StreamDecoderImpl. External API isn't changed for
RecordBatchStreamReader and StreamDecoder.
This PR adds some external API to implement this:
arrow::Status::ToStringWithoutContextLines(): This is only for testing. We can get stable result of ASSERT_RAISES_WITH_MESSAGE() with/without -DARROW_EXTRA_ERROR_CONTEXT=ON by this.
We can extract this and related changes to separated PR if we want.
arrow::ipc::Listener::OnRecordBatchWithMetadataDecoded(): Because RecordBatchStreamReader wants not only RecordBatch but also custom metadata. OnRecordBatchWithMetadataDecoded() receives RecordBatchWithMetadata. OnRecordBatchDecoded() still exists and it's used by default for backward compatibility.
arrow::ipc::CollectListener::metadatas(), arrow::ipc::CollectListener::num_record_batches(), arrow::ipc::CollectListener::PopRecordBatch(), arrow::ipc::CollectListener::PopRecordBatchWithMetadat(): If we add these APIs, we can use CollectListner in RecordBatchStreamReader. We can create an internal listener only for RecordBatchStreamReader if don't want to extend CollectListener.
Are these changes tested?
Yes.
Are there any user-facing changes?
Yes.
This PR includes breaking changes to public APIs.
arrow::ipc::CollectListener::record_batches()returnsconst std::vector<std::shared_ptr<RecordBatch>>&instead ofstd::vector<std::shared_ptr<RecordBatch>>.