parquet 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb28e49c647fcf9dddba5d18806b366e73ecaa6fb3bf8a3534eb7df4749710f0
4
- data.tar.gz: 44953fd9a1f3fc89f24754a6cb555f4d32a90d4af4bb4aa3c14fc373a1c389df
3
+ metadata.gz: 2b5b56cca903ed731d6981d3113e3833a6e6a6a0ffcd301040b32ab0c72bf9c1
4
+ data.tar.gz: 0e4486e2a67a051852166ac81754c9bfb2807c2ffa51eeda5edb41050432e930
5
5
  SHA512:
6
- metadata.gz: eaa9767d45deab2c3ba3fb0fc4c7aeb222b4446494262ff01083bdc488cca3164feee0f2f07bff644a3196479da0db4049dee1395b8b89f87f5aeba24a97b60b
7
- data.tar.gz: 805a9cad6698f6ade3a61b40eb514a948ed6b07682db0bd3e724aad533468a114053b9589ec6261c31e8fe6b244c4808457f9e801a6991dffa86a36326736ab0
6
+ metadata.gz: affe353c972f130973b309ca1ee928928278254830fa39bee8e4bed5452b5b381e2d27f6986067a0f9b27769a78f195887d371dc4825f61096414af92e9edb94
7
+ data.tar.gz: 9c823757be4b81d3ccafb57571c1d98b530a0d10696712083a0447b4871bf90720ba588d8c48777926b3f7a7f2ffede0c2ed7c9a076420b4dea183b7290ba47e
@@ -184,37 +184,53 @@ impl Length for RubyReader {
184
184
  }
185
185
  RubyReader::RubyIoLike { inner } => {
186
186
  let unwrapped_inner = ruby.get_inner(*inner);
187
- let current_pos = unwrapped_inner.funcall::<_, _, u64>("seek", (0, 1));
188
187
 
189
- if let Err(e) = current_pos {
188
+ // Get current position
189
+ let current_pos = match unwrapped_inner.funcall::<_, _, u64>("pos", ()) {
190
+ Ok(pos) => pos,
191
+ Err(e) => {
192
+ eprintln!("Error seeking: {}", e);
193
+ return 0;
194
+ }
195
+ };
196
+
197
+ // Seek to end
198
+ if let Err(e) = unwrapped_inner.funcall::<_, _, u64>("seek", (0, 2)) {
190
199
  eprintln!("Error seeking: {}", e);
191
200
  return 0;
192
201
  }
193
202
 
194
- if let Err(e) = unwrapped_inner.funcall::<_, _, u64>("seek", (0, 2)) {
203
+ // Offset at the end of the file is the length of the file
204
+ let size = match unwrapped_inner.funcall::<_, _, u64>("pos", ()) {
205
+ Ok(pos) => pos,
206
+ Err(e) => {
207
+ eprintln!("Error seeking: {}", e);
208
+ return 0;
209
+ }
210
+ };
211
+
212
+ // Restore original position
213
+ if let Err(e) = unwrapped_inner.funcall::<_, _, u64>("seek", (current_pos, 0)) {
195
214
  eprintln!("Error seeking: {}", e);
196
215
  return 0;
197
216
  }
198
217
 
199
- let size = unwrapped_inner.funcall::<_, _, u64>("pos", ());
200
-
201
- match size {
202
- Ok(size) => {
203
- // Restore original position
204
- if let Err(e) = unwrapped_inner.funcall::<_, _, u64>(
205
- "seek",
206
- (current_pos.expect("Current position is not set!"), 0),
207
- ) {
208
- eprintln!("Error seeking: {}", e);
209
- return 0;
210
- }
211
- size
212
- }
218
+ let final_pos = match unwrapped_inner.funcall::<_, _, u64>("pos", ()) {
219
+ Ok(pos) => pos,
213
220
  Err(e) => {
214
221
  eprintln!("Error seeking: {}", e);
215
222
  return 0;
216
223
  }
217
- }
224
+ };
225
+
226
+ assert_eq!(
227
+ current_pos, final_pos,
228
+ "Failed to restore original position in seekable IO object. Started at position {}, but ended at {}",
229
+ current_pos,
230
+ final_pos
231
+ );
232
+
233
+ size
218
234
  }
219
235
  }
220
236
  }
@@ -1,3 +1,3 @@
1
1
  module Parquet
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parquet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Jaremko