rdettai commented on a change in pull request #8300: URL: https://github.com/apache/arrow/pull/8300#discussion_r509056820
########## File path: rust/parquet/src/util/cursor.rs ########## @@ -0,0 +1,203 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use std::cmp; +use std::io::{self, Error, ErrorKind, Read, Seek, SeekFrom}; +use std::rc::Rc; + +/// This is object to use if your file is already in memory. +/// The sliceable cursor is similar to std::io::Cursor, except that it makes it easy to create "cursor slices". +/// To achieve this, it uses Rc instead of shared references. Indeed reference fields are painfull Review comment: This is not a new feature but an adaptation of what we had before. Without `SliceableCursor` there is no way to read from RAM the way it was done with `Cursor`. Instead of directly implementing the new `ChunkReader` trait for `Cursor` and having the same problem of copying the data all over the place as we did before, I tweeked the `Cursor` a bit to share its data between the `Read` slices. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
