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 +4 -4
- data/ext/parquet/src/ruby_reader.rs +34 -18
- data/lib/parquet/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b5b56cca903ed731d6981d3113e3833a6e6a6a0ffcd301040b32ab0c72bf9c1
|
4
|
+
data.tar.gz: 0e4486e2a67a051852166ac81754c9bfb2807c2ffa51eeda5edb41050432e930
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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
|
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
|
}
|
data/lib/parquet/version.rb
CHANGED