Skip to content

Commit 4655b5c

Browse files
chore!: add missing reader and writer features, make feature enums internal_api (delta-io#998)
## What changes are proposed in this pull request? This PR adds the missing features `clustering` and `variantType` to the reader and writer feature enums. delta-rs also needs to be able to inspect reader / writer features since the feature support is still somewhat decoupled from kernel. To facilitate adoption of kernel we therefore also expose `reader_features` and `writer_features` on the `Protocol` action behind the `internal-api` flag. ### This PR affects the following public APIs exposes `reader_features` and `writer_features` on the `Protocol` action behind the `internal-api` flag. reader/writer feature enums are now `internal-api` only (not `pub`) ## How was this change tested? new roundtrip cases for new variants. --------- Co-authored-by: Zach Schuermann <zachary.zvs@gmail.com>
1 parent c225652 commit 4655b5c

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

kernel/src/actions/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,13 @@ impl Protocol {
298298
}
299299

300300
/// Get the reader features for the protocol
301+
#[internal_api]
301302
pub(crate) fn reader_features(&self) -> Option<&[ReaderFeature]> {
302303
self.reader_features.as_deref()
303304
}
304305

305306
/// Get the writer features for the protocol
307+
#[internal_api]
306308
pub(crate) fn writer_features(&self) -> Option<&[WriterFeature]> {
307309
self.writer_features.as_deref()
308310
}

kernel/src/table_features/mod.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use strum::{AsRefStr, Display as StrumDisplay, EnumCount, EnumString};
55

66
use crate::schema::derive_macro_utils::ToDataType;
77
use crate::schema::DataType;
8+
use delta_kernel_derive::internal_api;
89

910
pub(crate) use column_mapping::column_mapping_mode;
1011
pub use column_mapping::{validate_schema_column_mapping, ColumnMappingMode};
@@ -33,7 +34,8 @@ mod timestamp_ntz;
3334
)]
3435
#[strum(serialize_all = "camelCase")]
3536
#[serde(rename_all = "camelCase")]
36-
pub enum ReaderFeature {
37+
#[internal_api]
38+
pub(crate) enum ReaderFeature {
3739
/// Mapping of one column to another
3840
ColumnMapping,
3941
/// Deletion vectors for merge, update, delete
@@ -52,6 +54,8 @@ pub enum ReaderFeature {
5254
/// vacuumProtocolCheck ReaderWriter feature ensures consistent application of reader and writer
5355
/// protocol checks during VACUUM operations
5456
VacuumProtocolCheck,
57+
/// This feature enables support for the variant data type, which stores semi-structured data.
58+
VariantType,
5559
#[serde(untagged)]
5660
#[strum(default)]
5761
Unknown(String),
@@ -77,7 +81,8 @@ pub enum ReaderFeature {
7781
)]
7882
#[strum(serialize_all = "camelCase")]
7983
#[serde(rename_all = "camelCase")]
80-
pub enum WriterFeature {
84+
#[internal_api]
85+
pub(crate) enum WriterFeature {
8186
/// Append Only Tables
8287
AppendOnly,
8388
/// Table invariants
@@ -118,6 +123,13 @@ pub enum WriterFeature {
118123
/// vacuumProtocolCheck ReaderWriter feature ensures consistent application of reader and writer
119124
/// protocol checks during VACUUM operations
120125
VacuumProtocolCheck,
126+
/// The Clustered Table feature facilitates the physical clustering of rows
127+
/// that share similar values on a predefined set of clustering columns.
128+
#[strum(serialize = "clustering")]
129+
#[serde(rename = "clustering")]
130+
ClusteredTable,
131+
/// This feature enables support for the variant data type, which stores semi-structured data.
132+
VariantType,
121133
#[serde(untagged)]
122134
#[strum(default)]
123135
Unknown(String),
@@ -221,6 +233,7 @@ mod tests {
221233
(ReaderFeature::TypeWideningPreview, "typeWidening-preview"),
222234
(ReaderFeature::V2Checkpoint, "v2Checkpoint"),
223235
(ReaderFeature::VacuumProtocolCheck, "vacuumProtocolCheck"),
236+
(ReaderFeature::VariantType, "variantType"),
224237
(ReaderFeature::unknown("something"), "something"),
225238
];
226239

@@ -260,6 +273,8 @@ mod tests {
260273
(WriterFeature::IcebergCompatV1, "icebergCompatV1"),
261274
(WriterFeature::IcebergCompatV2, "icebergCompatV2"),
262275
(WriterFeature::VacuumProtocolCheck, "vacuumProtocolCheck"),
276+
(WriterFeature::ClusteredTable, "clustering"),
277+
(WriterFeature::VariantType, "variantType"),
263278
(WriterFeature::unknown("something"), "something"),
264279
];
265280

0 commit comments

Comments
 (0)