Skip to content

Commit d542433

Browse files
committed
Add deprecation warnings for everything related to dict_id
1 parent 4acf4d3 commit d542433

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

arrow-ipc/src/writer.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ pub struct IpcWriteOptions {
6565
/// schema or generate unique dictionary IDs internally during encoding.
6666
///
6767
/// Defaults to `false`
68+
#[deprecated(
69+
since = "54.0.0",
70+
note = "The ability to preserve dictionary IDs will be removed. With it, all fields related to it."
71+
)]
6872
preserve_dict_id: bool,
6973
}
7074

@@ -138,6 +142,10 @@ impl IpcWriteOptions {
138142

139143
/// Return whether the writer is configured to preserve the dictionary IDs
140144
/// defined in the schema
145+
#[deprecated(
146+
since = "54.0.0",
147+
note = "The ability to preserve dictionary IDs will be removed. With it, all functions related to it."
148+
)]
141149
pub fn preserve_dict_id(&self) -> bool {
142150
self.preserve_dict_id
143151
}
@@ -149,6 +157,10 @@ impl IpcWriteOptions {
149157
/// to the dictionary batches in order to encode them correctly
150158
///
151159
/// The default will change to `false` in future releases
160+
#[deprecated(
161+
since = "54.0.0",
162+
note = "The ability to preserve dictionary IDs will be removed. With it, all functions related to it."
163+
)]
152164
pub fn with_preserve_dict_id(mut self, preserve_dict_id: bool) -> Self {
153165
self.preserve_dict_id = preserve_dict_id;
154166
self
@@ -767,6 +779,10 @@ pub struct DictionaryTracker {
767779
written: HashMap<i64, ArrayData>,
768780
dict_ids: Vec<i64>,
769781
error_on_replacement: bool,
782+
#[deprecated(
783+
since = "54.0.0",
784+
note = "The ability to preserve dictionary IDs will be removed. With it, all fields related to it."
785+
)]
770786
preserve_dict_id: bool,
771787
}
772788

@@ -795,6 +811,10 @@ impl DictionaryTracker {
795811
/// If `error_on_replacement`
796812
/// is true, an error will be generated if an update to an
797813
/// existing dictionary is attempted.
814+
#[deprecated(
815+
since = "54.0.0",
816+
note = "The ability to preserve dictionary IDs will be removed. With it, all functions related to it."
817+
)]
798818
pub fn new_with_preserve_dict_id(error_on_replacement: bool, preserve_dict_id: bool) -> Self {
799819
Self {
800820
written: HashMap::new(),
@@ -811,6 +831,10 @@ impl DictionaryTracker {
811831
///
812832
/// If `preserve_dict_id` is false, this will return the value of the last `dict_id` assigned incremented by 1
813833
/// or 0 in the case where no dictionary IDs have yet been assigned
834+
#[deprecated(
835+
since = "54.0.0",
836+
note = "The ability to preserve dictionary IDs will be removed. With it, all functions related to it."
837+
)]
814838
pub fn set_dict_id(&mut self, field: &Field) -> i64 {
815839
let next = if self.preserve_dict_id {
816840
field.dict_id().expect("no dict_id in field")

arrow-schema/src/field.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ pub struct Field {
3838
name: String,
3939
data_type: DataType,
4040
nullable: bool,
41+
#[deprecated(
42+
since = "54.0.0",
43+
note = "The ability to preserve dictionary IDs will be removed. With it, all fields related to it."
44+
)]
4145
dict_id: i64,
4246
dict_is_ordered: bool,
4347
/// A map of key-value pairs containing additional custom meta data.
@@ -151,6 +155,10 @@ impl Field {
151155
}
152156

153157
/// Creates a new field that has additional dictionary information
158+
#[deprecated(
159+
since = "54.0.0",
160+
note = "The ability to preserve dictionary IDs will be removed. With the dict_id field disappearing this function signature will change by removing the dict_id parameter."
161+
)]
154162
pub fn new_dict(
155163
name: impl Into<String>,
156164
data_type: DataType,
@@ -386,6 +394,10 @@ impl Field {
386394
/// Returns a vector containing all (potentially nested) `Field` instances selected by the
387395
/// dictionary ID they use
388396
#[inline]
397+
#[deprecated(
398+
since = "54.0.0",
399+
note = "The ability to preserve dictionary IDs will be removed. With it, all fields related to it."
400+
)]
389401
pub(crate) fn fields_with_dict_id(&self, id: i64) -> Vec<&Field> {
390402
self.fields()
391403
.into_iter()
@@ -397,6 +409,10 @@ impl Field {
397409

398410
/// Returns the dictionary ID, if this is a dictionary type.
399411
#[inline]
412+
#[deprecated(
413+
since = "54.0.0",
414+
note = "The ability to preserve dictionary IDs will be removed. With it, all fields related to it."
415+
)]
400416
pub const fn dict_id(&self) -> Option<i64> {
401417
match self.data_type {
402418
DataType::Dictionary(_, _) => Some(self.dict_id),

0 commit comments

Comments
 (0)