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

Add len() to InMemoryWriteableCursor #564

Merged
merged 2 commits into from
Jul 20, 2021

Conversation

mosyp
Copy link
Contributor

@mosyp mosyp commented Jul 19, 2021

Which issue does this PR close?

Resolves the delta-io/kafka-delta-ingest#38

Rationale for this change

There's no efficient way to get buffer length unless copying the data via .data() func. These changes provide easy and safe way top achieve that.

What changes are included in this PR?

Basically the same impl as in .data(), but once we've got the ref then the len() on the underlying is called instead of copying the bytes.

Are there any user-facing changes?

new pub api (?).

@github-actions github-actions bot added the parquet Changes to the parquet crate label Jul 19, 2021
@alamb
Copy link
Contributor

alamb commented Jul 19, 2021

Thanks @mosyp

@alamb
Copy link
Contributor

alamb commented Jul 19, 2021

@mosyp it appears clippy has a problem !

https://github.com/apache/arrow-rs/pull/564/checks?check_run_id=3107500562

Can you please fix the error?

warning: build failed, waiting for other jobs to finish...
error: struct `InMemoryWriteableCursor` has a public `len` method, but no `is_empty` method
   --> parquet/src/util/cursor.rs:159:5
    |
159 |     pub fn len(&self) -> usize {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `-D clippy::len-without-is-empty` implied by `-D warnings`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_without_is_empty

error: aborting due to previous error

@codecov-commenter
Copy link

codecov-commenter commented Jul 19, 2021

Codecov Report

Merging #564 (593fc7a) into master (f873d77) will decrease coverage by 0.03%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #564      +/-   ##
==========================================
- Coverage   82.47%   82.44%   -0.04%     
==========================================
  Files         167      167              
  Lines       46144    46165      +21     
==========================================
  Hits        38059    38059              
- Misses       8085     8106      +21     
Impacted Files Coverage Δ
parquet/src/util/cursor.rs 78.99% <0.00%> (-4.20%) ⬇️
parquet/src/record/triplet.rs 92.37% <0.00%> (-0.42%) ⬇️
arrow/src/array/array_struct.rs 89.11% <0.00%> (ø)
arrow-flight/src/arrow.flight.protocol.rs 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f873d77...593fc7a. Read the comment docs.

@mosyp
Copy link
Contributor Author

mosyp commented Jul 20, 2021

Thanks @alamb. I've added the is_empty() to make clippy happy

@alamb
Copy link
Contributor

alamb commented Jul 20, 2021

Thanks @mosyp !

@alamb alamb merged commit 6c82bdc into apache:master Jul 20, 2021
alamb pushed a commit that referenced this pull request Jul 20, 2021
* Add len() to InMemoryWriteableCursor

* Add is_empty to make clippy happy
alamb added a commit that referenced this pull request Jul 21, 2021
* Add len() to InMemoryWriteableCursor

* Add is_empty to make clippy happy

Co-authored-by: Mykhailo Osypov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parquet Changes to the parquet crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants