@@ -1477,135 +1477,6 @@ mod tests {
14771477 }
14781478 }
14791479
1480- use crate :: table_configuration:: TableConfiguration ;
1481- use crate :: utils:: test_utils:: assert_result_error_with_message;
1482-
1483- // TODO: Migrate these protocol validation tests to TableConfiguration.
1484- // The ensure_read_supported and ensure_write_supported methods have been moved from Protocol
1485- // to TableConfiguration. These tests should be refactored to use TableConfiguration instead.
1486-
1487- // Helper to create a TableConfiguration for testing protocol validation
1488- fn create_table_config_for_protocol ( protocol : Protocol ) -> DeltaResult < TableConfiguration > {
1489- let schema = StructType :: new_unchecked ( [ StructField :: nullable ( "value" , DataType :: INTEGER ) ] ) ;
1490- let metadata = Metadata :: try_new ( None , None , schema, vec ! [ ] , 0 , HashMap :: new ( ) ) ?;
1491- let table_root = url:: Url :: parse ( "file:///tmp/test" ) . unwrap ( ) ;
1492- TableConfiguration :: try_new ( metadata, protocol, table_root, 0 )
1493- }
1494-
1495- #[ test]
1496- fn test_v2_checkpoint_supported ( ) {
1497- let protocol = Protocol :: try_new (
1498- 3 ,
1499- 7 ,
1500- Some ( [ TableFeature :: V2Checkpoint ] ) ,
1501- Some ( [ TableFeature :: V2Checkpoint ] ) ,
1502- )
1503- . unwrap ( ) ;
1504- assert ! ( create_table_config_for_protocol( protocol) . is_ok( ) ) ;
1505- }
1506-
1507- #[ test]
1508- fn test_ensure_read_supported ( ) {
1509- let protocol = Protocol {
1510- min_reader_version : 3 ,
1511- min_writer_version : 7 ,
1512- reader_features : Some ( vec ! [ ] ) ,
1513- writer_features : Some ( vec ! [ ] ) ,
1514- } ;
1515- assert ! ( create_table_config_for_protocol( protocol) . is_ok( ) ) ;
1516-
1517- let protocol = Protocol :: try_new (
1518- 3 ,
1519- 7 ,
1520- Some ( [ TableFeature :: V2Checkpoint ] ) ,
1521- Some ( [ TableFeature :: V2Checkpoint ] ) ,
1522- )
1523- . unwrap ( ) ;
1524- assert ! ( create_table_config_for_protocol( protocol) . is_ok( ) ) ;
1525-
1526- let protocol = Protocol {
1527- min_reader_version : 1 ,
1528- min_writer_version : 7 ,
1529- reader_features : None ,
1530- writer_features : None ,
1531- } ;
1532- assert ! ( create_table_config_for_protocol( protocol) . is_ok( ) ) ;
1533-
1534- let protocol = Protocol {
1535- min_reader_version : 2 ,
1536- min_writer_version : 7 ,
1537- reader_features : None ,
1538- writer_features : None ,
1539- } ;
1540- assert ! ( create_table_config_for_protocol( protocol) . is_ok( ) ) ;
1541- }
1542-
1543- #[ test]
1544- fn test_ensure_write_supported ( ) {
1545- let protocol = Protocol :: try_new (
1546- 3 ,
1547- 7 ,
1548- Some ( vec ! [ TableFeature :: DeletionVectors ] ) ,
1549- Some ( vec ! [
1550- TableFeature :: AppendOnly ,
1551- TableFeature :: DeletionVectors ,
1552- TableFeature :: DomainMetadata ,
1553- TableFeature :: Invariants ,
1554- TableFeature :: RowTracking ,
1555- ] ) ,
1556- )
1557- . unwrap ( ) ;
1558- let config = create_table_config_for_protocol ( protocol) . unwrap ( ) ;
1559- assert ! ( config. ensure_write_supported( ) . is_ok( ) ) ;
1560-
1561- // Verify that unsupported reader features are rejected (TypeWidening is a ReaderWriter feature not supported for writes)
1562- let protocol = Protocol :: try_new (
1563- 3 ,
1564- 7 ,
1565- Some ( [ TableFeature :: TypeWidening ] ) ,
1566- Some ( [ TableFeature :: TypeWidening ] ) ,
1567- )
1568- . unwrap ( ) ;
1569- let config = create_table_config_for_protocol ( protocol) . unwrap ( ) ;
1570- assert_result_error_with_message (
1571- config. ensure_write_supported ( ) ,
1572- r#"Feature 'typeWidening' not supported for writes"# ,
1573- ) ;
1574-
1575- // Unknown writer features are allowed during Protocol creation for forward compatibility,
1576- // but will fail when trying to create TableConfiguration (reads not supported)
1577- let protocol = Protocol :: try_new (
1578- 3 ,
1579- 7 ,
1580- Some ( [ TableFeature :: Unknown ( "unsupported feature" . to_string ( ) ) ] ) ,
1581- Some ( [ TableFeature :: Unknown ( "unsupported feature" . to_string ( ) ) ] ) ,
1582- )
1583- . unwrap ( ) ;
1584- assert_result_error_with_message (
1585- create_table_config_for_protocol ( protocol) ,
1586- r#"Unsupported: Unknown feature 'unsupported feature'"# ,
1587- ) ;
1588- }
1589-
1590- #[ test]
1591- fn test_illegal_writer_feature_combination ( ) {
1592- let protocol = Protocol :: try_new (
1593- 3 ,
1594- 7 ,
1595- Some :: < Vec < String > > ( vec ! [ ] ) ,
1596- Some ( vec ! [
1597- // No domain metadata even though that is required
1598- TableFeature :: RowTracking ,
1599- ] ) ,
1600- )
1601- . unwrap ( ) ;
1602- let config = create_table_config_for_protocol ( protocol) . unwrap ( ) ;
1603- assert_result_error_with_message (
1604- config. ensure_write_supported ( ) ,
1605- "rowTracking requires domainMetadata to be supported" ,
1606- ) ;
1607- }
1608-
16091480 #[ test]
16101481 fn test_ensure_supported_features ( ) {
16111482 let supported_features = [ TableFeature :: ColumnMapping , TableFeature :: DeletionVectors ] ;
@@ -1636,30 +1507,6 @@ mod tests {
16361507 assert_eq ! ( parse_features:: <TableFeature >( features) , expected) ;
16371508 }
16381509
1639- #[ cfg( feature = "catalog-managed" ) ]
1640- #[ test]
1641- fn test_catalog_managed_writes ( ) {
1642- let protocol = Protocol :: try_new (
1643- 3 ,
1644- 7 ,
1645- Some ( [ TableFeature :: CatalogManaged ] ) ,
1646- Some ( [ TableFeature :: CatalogManaged ] ) ,
1647- )
1648- . unwrap ( ) ;
1649- let config = create_table_config_for_protocol ( protocol) . unwrap ( ) ;
1650- assert ! ( config. ensure_write_supported( ) . is_ok( ) ) ;
1651-
1652- let protocol = Protocol :: try_new (
1653- 3 ,
1654- 7 ,
1655- Some ( [ TableFeature :: CatalogOwnedPreview ] ) ,
1656- Some ( [ TableFeature :: CatalogOwnedPreview ] ) ,
1657- )
1658- . unwrap ( ) ;
1659- let config = create_table_config_for_protocol ( protocol) . unwrap ( ) ;
1660- assert ! ( config. ensure_write_supported( ) . is_ok( ) ) ;
1661- }
1662-
16631510 #[ test]
16641511 fn test_into_engine_data ( ) {
16651512 let engine = ExprEngine :: new ( ) ;
0 commit comments