22//! specification](https://github.com/delta-io/delta/blob/master/PROTOCOL.md)
33
44use std:: collections:: HashMap ;
5- use std:: fmt:: { Debug , Display } ;
6- use std:: hash:: Hash ;
5+ use std:: fmt:: Debug ;
76use std:: str:: FromStr ;
87use std:: sync:: { Arc , LazyLock } ;
98
@@ -24,7 +23,6 @@ use url::Url;
2423use visitors:: { MetadataVisitor , ProtocolVisitor } ;
2524
2625use delta_kernel_derive:: { internal_api, IntoEngineData , ToSchema } ;
27- use itertools:: Itertools ;
2826use serde:: { Deserialize , Serialize } ;
2927
3028const KERNEL_VERSION : & str = env ! ( "CARGO_PKG_VERSION" ) ;
@@ -568,33 +566,6 @@ impl Protocol {
568566 self . has_table_feature ( & TableFeature :: CatalogManaged )
569567 || self . has_table_feature ( & TableFeature :: CatalogOwnedPreview )
570568 }
571-
572- pub ( crate ) fn is_cdf_supported ( & self ) -> bool {
573- // TODO: we should probably expand this to ~all supported reader features instead of gating
574- // on a subset here. missing ones are:
575- // - variantType
576- // - typeWidening
577- // - catalogManaged
578- static CDF_SUPPORTED_READER_FEATURES : LazyLock < Vec < TableFeature > > = LazyLock :: new ( || {
579- vec ! [
580- TableFeature :: DeletionVectors ,
581- TableFeature :: ColumnMapping ,
582- TableFeature :: TimestampWithoutTimezone ,
583- TableFeature :: V2Checkpoint ,
584- TableFeature :: VacuumProtocolCheck ,
585- ]
586- } ) ;
587- match self . reader_features ( ) {
588- // if min_reader_version = 3 and all reader features are subset of supported => OK
589- Some ( reader_features) if self . min_reader_version ( ) == 3 => {
590- ensure_supported_features ( reader_features, & CDF_SUPPORTED_READER_FEATURES ) . is_ok ( )
591- }
592- // if min_reader_version = 1 or 2 and there are no reader features => OK
593- None => ( 1 ..=2 ) . contains ( & self . min_reader_version ( ) ) ,
594- // any other protocol is not supported
595- _ => false ,
596- }
597- }
598569}
599570
600571// TODO: implement Scalar::From<HashMap<K, V>> so we can derive IntoEngineData using a macro (issue#1083)
@@ -636,43 +607,6 @@ impl IntoEngineData for Protocol {
636607 }
637608}
638609
639- // given `table_features`, check if they are subset of `supported_features`
640- pub ( crate ) fn ensure_supported_features < T > (
641- table_features : & [ T ] ,
642- supported_features : & [ T ] ,
643- ) -> DeltaResult < ( ) >
644- where
645- T : Display + FromStr + Hash + Eq ,
646- <T as FromStr >:: Err : Display ,
647- {
648- // first check if all features are supported, else we proceed to craft an error message
649- if table_features
650- . iter ( )
651- . all ( |feature| supported_features. contains ( feature) )
652- {
653- return Ok ( ( ) ) ;
654- }
655-
656- // we get the type name (TableFeature) for better error messages
657- let features_type = std:: any:: type_name :: < T > ( )
658- . rsplit ( "::" )
659- . next ( )
660- . unwrap_or ( "table feature" ) ;
661-
662- // NB: we didn't do this above to avoid allocation in the common case
663- let mut unsupported = table_features
664- . iter ( )
665- . filter ( |feature| !supported_features. contains ( * feature) ) ;
666-
667- Err ( Error :: Unsupported ( format ! (
668- "Found unsupported {}s: \" {}\" . Supported {}s: \" {}\" " ,
669- features_type,
670- unsupported. join( "\" , \" " ) ,
671- features_type,
672- supported_features. iter( ) . join( "\" , \" " ) ,
673- ) ) )
674- }
675-
676610#[ derive( Debug , Clone , PartialEq , Eq , ToSchema ) ]
677611#[ internal_api]
678612#[ cfg_attr( test, derive( Serialize , Default ) , serde( rename_all = "camelCase" ) ) ]
0 commit comments