Skip to content

Commit 3183e03

Browse files
authored
Remove functions from parquet crate deprecated in or before 54.0.0 (#7811)
# Which issue does this PR close? Part of #7810 # Rationale for this change Reducing code bloat. # What changes are included in this PR? Remove deprecated functions and structs. # Are these changes tested? Removed functions were not referenced so no tests necessary # Are there any user-facing changes? Yes, public functions are removed.
1 parent 8d6cada commit 3183e03

File tree

12 files changed

+18
-723
lines changed

12 files changed

+18
-723
lines changed

parquet/src/arrow/async_reader/metadata.rs

Lines changed: 15 additions & 362 deletions
Large diffs are not rendered by default.

parquet/src/arrow/async_reader/store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl ParquetObjectReader {
7777
}
7878

7979
/// Provide a hint as to the size of the parquet file's footer,
80-
/// see [fetch_parquet_metadata](crate::arrow::async_reader::fetch_parquet_metadata)
80+
/// see [`ParquetMetaDataReader::with_prefetch_hint`]
8181
pub fn with_footer_size_hint(self, hint: usize) -> Self {
8282
Self {
8383
metadata_size_hint: Some(hint),

parquet/src/arrow/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,6 @@ pub use self::async_reader::ParquetRecordBatchStreamBuilder;
202202
pub use self::async_writer::AsyncArrowWriter;
203203
use crate::schema::types::{SchemaDescriptor, Type};
204204
use arrow_schema::{FieldRef, Schema};
205-
// continue to export deprecated methods until they are removed
206-
#[allow(deprecated)]
207-
pub use self::schema::arrow_to_parquet_schema;
208205

209206
pub use self::schema::{
210207
add_encoded_arrow_schema_to_metadata, encode_arrow_schema, parquet_to_arrow_field_levels,

parquet/src/arrow/schema/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -358,15 +358,6 @@ impl<'a> ArrowSchemaConverter<'a> {
358358
}
359359
}
360360

361-
/// Convert arrow schema to parquet schema
362-
///
363-
/// The name of the root schema element defaults to `"arrow_schema"`, this can be
364-
/// overridden with [`ArrowSchemaConverter`]
365-
#[deprecated(since = "54.0.0", note = "Use `ArrowSchemaConverter` instead")]
366-
pub fn arrow_to_parquet_schema(schema: &Schema) -> Result<SchemaDescriptor> {
367-
ArrowSchemaConverter::new().convert(schema)
368-
}
369-
370361
fn parse_key_value_metadata(
371362
key_value_metadata: Option<&Vec<KeyValue>>,
372363
) -> Option<HashMap<String, String>> {

parquet/src/column/writer/mod.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,6 @@ impl ColumnWriter<'_> {
102102
}
103103
}
104104

105-
#[deprecated(
106-
since = "54.0.0",
107-
note = "Seems like a stray and nobody knows what's it for. Will be removed in the next release."
108-
)]
109-
#[allow(missing_docs)]
110-
pub enum Level {
111-
Page,
112-
Column,
113-
}
114-
115105
/// Gets a specific column writer corresponding to column descriptor `descr`.
116106
pub fn get_column_writer<'a>(
117107
descr: ColumnDescPtr,

parquet/src/data_type.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,6 @@ impl Int96 {
7474
self.value = [elem0, elem1, elem2];
7575
}
7676

77-
/// Converts this INT96 into an i64 representing the number of MILLISECONDS since Epoch
78-
#[deprecated(since = "54.0.0", note = "Use `to_millis` instead")]
79-
pub fn to_i64(&self) -> i64 {
80-
self.to_millis()
81-
}
82-
8377
/// Converts this INT96 into an i64 representing the number of SECONDS since EPOCH
8478
///
8579
/// Will wrap around on overflow
@@ -1214,26 +1208,6 @@ pub trait DataType: 'static + Send {
12141208
Self: Sized;
12151209
}
12161210

1217-
// Workaround bug in specialization
1218-
#[deprecated(
1219-
since = "54.0.0",
1220-
note = "Seems like a stray and nobody knows what's it for. Will be removed in 55.0.0"
1221-
)]
1222-
#[allow(missing_docs)]
1223-
pub trait SliceAsBytesDataType: DataType
1224-
where
1225-
Self::T: SliceAsBytes,
1226-
{
1227-
}
1228-
1229-
#[allow(deprecated)]
1230-
impl<T> SliceAsBytesDataType for T
1231-
where
1232-
T: DataType,
1233-
<T as DataType>::T: SliceAsBytes,
1234-
{
1235-
}
1236-
12371211
macro_rules! make_type {
12381212
($name:ident, $reader_ident: ident, $writer_ident: ident, $native_ty:ty, $size:expr) => {
12391213
#[doc = concat!("Parquet physical type: ", stringify!($name))]

parquet/src/file/footer.rs

Lines changed: 0 additions & 81 deletions
This file was deleted.

parquet/src/file/metadata/mod.rs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -208,22 +208,6 @@ impl ParquetMetaData {
208208
self.file_decryptor = file_decryptor;
209209
}
210210

211-
/// Creates Parquet metadata from file metadata, a list of row
212-
/// group metadata, and the column index structures.
213-
#[deprecated(since = "53.1.0", note = "Use ParquetMetaDataBuilder")]
214-
pub fn new_with_page_index(
215-
file_metadata: FileMetaData,
216-
row_groups: Vec<RowGroupMetaData>,
217-
column_index: Option<ParquetColumnIndex>,
218-
offset_index: Option<ParquetOffsetIndex>,
219-
) -> Self {
220-
ParquetMetaDataBuilder::new(file_metadata)
221-
.set_row_groups(row_groups)
222-
.set_column_index(column_index)
223-
.set_offset_index(offset_index)
224-
.build()
225-
}
226-
227211
/// Convert this ParquetMetaData into a [`ParquetMetaDataBuilder`]
228212
pub fn into_builder(self) -> ParquetMetaDataBuilder {
229213
self.into()
@@ -1397,20 +1381,6 @@ impl ColumnChunkMetaDataBuilder {
13971381
self
13981382
}
13991383

1400-
/// Sets file offset in bytes.
1401-
///
1402-
/// This field was meant to provide an alternate to storing `ColumnMetadata` directly in
1403-
/// the `ColumnChunkMetadata`. However, most Parquet readers assume the `ColumnMetadata`
1404-
/// is stored inline and ignore this field.
1405-
#[deprecated(
1406-
since = "53.0.0",
1407-
note = "The Parquet specification requires this field to be 0"
1408-
)]
1409-
pub fn set_file_offset(mut self, value: i64) -> Self {
1410-
self.0.file_offset = value;
1411-
self
1412-
}
1413-
14141384
/// Sets number of values.
14151385
pub fn set_num_values(mut self, value: i64) -> Self {
14161386
self.0.num_values = value;

parquet/src/file/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@
9999
//! ```
100100
#[cfg(feature = "encryption")]
101101
pub mod column_crypto_metadata;
102-
pub mod footer;
103102
pub mod metadata;
104103
pub mod page_encoding_stats;
105104
pub mod page_index;

parquet/src/file/page_index/index_reader.rs

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
//! Support for reading [`Index`] and [`PageLocation`] from parquet metadata.
18+
//! Support for reading [`Index`] and [`OffsetIndex`] from parquet metadata.
1919
2020
use crate::basic::Type;
2121
use crate::data_type::Int96;
@@ -24,7 +24,7 @@ use crate::file::metadata::ColumnChunkMetaData;
2424
use crate::file::page_index::index::{Index, NativeIndex};
2525
use crate::file::page_index::offset_index::OffsetIndexMetaData;
2626
use crate::file::reader::ChunkReader;
27-
use crate::format::{ColumnIndex, OffsetIndex, PageLocation};
27+
use crate::format::{ColumnIndex, OffsetIndex};
2828
use crate::thrift::{TCompactSliceInputProtocol, TSerializable};
2929
use std::ops::Range;
3030

@@ -83,45 +83,6 @@ pub fn read_columns_indexes<R: ChunkReader>(
8383
.transpose()
8484
}
8585

86-
/// Reads [`OffsetIndex`], per-page [`PageLocation`] for all columns of a row
87-
/// group.
88-
///
89-
/// Returns a vector of `location[column_number][page_number]`
90-
///
91-
/// Return an empty vector if this row group does not contain an
92-
/// [`OffsetIndex]`.
93-
///
94-
/// See [Page Index Documentation] for more details.
95-
///
96-
/// [Page Index Documentation]: https://github.com/apache/parquet-format/blob/master/PageIndex.md
97-
#[deprecated(since = "53.0.0", note = "Use read_offset_indexes")]
98-
pub fn read_pages_locations<R: ChunkReader>(
99-
reader: &R,
100-
chunks: &[ColumnChunkMetaData],
101-
) -> Result<Vec<Vec<PageLocation>>, ParquetError> {
102-
let fetch = chunks
103-
.iter()
104-
.fold(None, |range, c| acc_range(range, c.offset_index_range()));
105-
106-
let fetch = match fetch {
107-
Some(r) => r,
108-
None => return Ok(vec![]),
109-
};
110-
111-
let bytes = reader.get_bytes(fetch.start as _, (fetch.end - fetch.start).try_into()?)?;
112-
113-
chunks
114-
.iter()
115-
.map(|c| match c.offset_index_range() {
116-
Some(r) => decode_page_locations(
117-
&bytes[usize::try_from(r.start - fetch.start)?
118-
..usize::try_from(r.end - fetch.start)?],
119-
),
120-
None => Err(general_err!("missing offset index")),
121-
})
122-
.collect()
123-
}
124-
12586
/// Reads per-column [`OffsetIndexMetaData`] for all columns of a row group by
12687
/// decoding [`OffsetIndex`] .
12788
///
@@ -172,12 +133,6 @@ pub(crate) fn decode_offset_index(data: &[u8]) -> Result<OffsetIndexMetaData, Pa
172133
OffsetIndexMetaData::try_new(offset)
173134
}
174135

175-
pub(crate) fn decode_page_locations(data: &[u8]) -> Result<Vec<PageLocation>, ParquetError> {
176-
let mut prot = TCompactSliceInputProtocol::new(data);
177-
let offset = OffsetIndex::read_from_in_protocol(&mut prot)?;
178-
Ok(offset.page_locations)
179-
}
180-
181136
pub(crate) fn decode_column_index(data: &[u8], column_type: Type) -> Result<Index, ParquetError> {
182137
let mut prot = TCompactSliceInputProtocol::new(data);
183138

0 commit comments

Comments
 (0)