Skip to content
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

[C++][Parquet] Minor: avoid re-create a new Reader object in Decoder::SetData #39845

Closed
mapleFU opened this issue Jan 30, 2024 · 0 comments · Fixed by #39847
Closed

[C++][Parquet] Minor: avoid re-create a new Reader object in Decoder::SetData #39845

mapleFU opened this issue Jan 30, 2024 · 0 comments · Fixed by #39847

Comments

@mapleFU
Copy link
Member

mapleFU commented Jan 30, 2024

Describe the enhancement requested

  void SetData(int num_values, const uint8_t* data, int len) override {
    // num_values is equal to page's num_values, including null values in this page
    this->num_values_ = num_values;
    decoder_ = std::make_shared<::arrow::bit_util::BitReader>(data, len);
  }

Should be

  void SetData(int num_values, const uint8_t* data, int len) override {
    // num_values is equal to page's num_values, including null values in this page
    this->num_values_ = num_values;
    if (decoder_ == nullptr) {
      decoder_ = std::make_shared<::arrow::bit_util::BitReader>(data, len);
    } else {
      decoder_->Reset(data, len);
    }

Component(s)

C++, Parquet

mapleFU added a commit to mapleFU/arrow that referenced this issue Jan 30, 2024
mapleFU added a commit that referenced this issue Feb 1, 2024
… Decoder::SetData (#39847)

### Rationale for this change

avoid creating a new Reader object in Decoder::SetData

### What changes are included in this PR?

avoid creating a new Reader object in Decoder::SetData

### Are these changes tested?

Already

### Are there any user-facing changes?

no

* Closes: #39845

Authored-by: mwish <[email protected]>
Signed-off-by: mwish <[email protected]>
@mapleFU mapleFU added this to the 16.0.0 milestone Feb 1, 2024
dgreiss pushed a commit to dgreiss/arrow that referenced this issue Feb 19, 2024
…ect in Decoder::SetData (apache#39847)

### Rationale for this change

avoid creating a new Reader object in Decoder::SetData

### What changes are included in this PR?

avoid creating a new Reader object in Decoder::SetData

### Are these changes tested?

Already

### Are there any user-facing changes?

no

* Closes: apache#39845

Authored-by: mwish <[email protected]>
Signed-off-by: mwish <[email protected]>
zanmato1984 pushed a commit to zanmato1984/arrow that referenced this issue Feb 28, 2024
…ect in Decoder::SetData (apache#39847)

### Rationale for this change

avoid creating a new Reader object in Decoder::SetData

### What changes are included in this PR?

avoid creating a new Reader object in Decoder::SetData

### Are these changes tested?

Already

### Are there any user-facing changes?

no

* Closes: apache#39845

Authored-by: mwish <[email protected]>
Signed-off-by: mwish <[email protected]>
thisisnic pushed a commit to thisisnic/arrow that referenced this issue Mar 8, 2024
…ect in Decoder::SetData (apache#39847)

### Rationale for this change

avoid creating a new Reader object in Decoder::SetData

### What changes are included in this PR?

avoid creating a new Reader object in Decoder::SetData

### Are these changes tested?

Already

### Are there any user-facing changes?

no

* Closes: apache#39845

Authored-by: mwish <[email protected]>
Signed-off-by: mwish <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant