@@ -411,7 +411,9 @@ mod tests {
411
411
use std:: vec;
412
412
413
413
use iceberg:: io:: FileIOBuilder ;
414
- use iceberg:: spec:: { NestedField , PartitionSpec , PrimitiveType , Schema , SortOrder , Type } ;
414
+ use iceberg:: spec:: {
415
+ NestedField , NullOrder , PartitionSpec , PrimitiveType , Schema , SortOrder , Type ,
416
+ } ;
415
417
use iceberg:: transaction:: Transaction ;
416
418
use regex:: Regex ;
417
419
use tempfile:: TempDir ;
@@ -1829,5 +1831,58 @@ mod tests {
1829
1831
updated_table. metadata( ) . properties( ) . get( "key" ) . unwrap( ) ,
1830
1832
"value"
1831
1833
) ;
1834
+
1835
+ assert_eq ! ( table. identifier( ) , updated_table. identifier( ) ) ;
1836
+ assert_eq ! ( table. metadata( ) . uuid( ) , updated_table. metadata( ) . uuid( ) ) ;
1837
+ assert ! ( table. metadata( ) . last_updated_ms( ) < updated_table. metadata( ) . last_updated_ms( ) ) ;
1838
+ assert_ne ! ( table. metadata_location( ) , updated_table. metadata_location( ) ) ;
1839
+ assert ! (
1840
+ table. metadata( ) . metadata_log( ) . len( ) < updated_table. metadata( ) . metadata_log( ) . len( )
1841
+ ) ;
1842
+ }
1843
+
1844
+ #[ tokio:: test]
1845
+ async fn test_update_table_fails_if_table_doesnt_exist ( ) {
1846
+ let catalog = new_memory_catalog ( ) ;
1847
+
1848
+ let namespace_ident = NamespaceIdent :: new ( "a" . into ( ) ) ;
1849
+ create_namespace ( & catalog, & namespace_ident) . await ;
1850
+ let table_ident = TableIdent :: new ( namespace_ident, "test" . to_string ( ) ) ;
1851
+
1852
+ // This table is not known to the catalog.
1853
+ let table = build_table ( table_ident) ;
1854
+
1855
+ let err = Transaction :: new ( & table)
1856
+ . set_properties ( HashMap :: from ( [ ( "key" . to_string ( ) , "value" . to_string ( ) ) ] ) )
1857
+ . unwrap ( )
1858
+ . commit ( & catalog)
1859
+ . await
1860
+ . unwrap_err ( ) ;
1861
+ assert_eq ! ( err. kind( ) , ErrorKind :: TableNotFound ) ;
1862
+ }
1863
+
1864
+ fn build_table ( ident : TableIdent ) -> Table {
1865
+ let file_io = FileIOBuilder :: new_fs_io ( ) . build ( ) . unwrap ( ) ;
1866
+
1867
+ let temp_dir = TempDir :: new ( ) . unwrap ( ) ;
1868
+ let location = temp_dir. path ( ) . to_str ( ) . unwrap ( ) . to_string ( ) ;
1869
+
1870
+ let table_creation = TableCreation :: builder ( )
1871
+ . name ( ident. name ( ) . to_string ( ) )
1872
+ . schema ( simple_table_schema ( ) )
1873
+ . location ( location)
1874
+ . build ( ) ;
1875
+ let metadata = TableMetadataBuilder :: from_table_creation ( table_creation)
1876
+ . unwrap ( )
1877
+ . build ( )
1878
+ . unwrap ( )
1879
+ . metadata ;
1880
+
1881
+ Table :: builder ( )
1882
+ . identifier ( ident)
1883
+ . metadata ( metadata)
1884
+ . file_io ( file_io)
1885
+ . build ( )
1886
+ . unwrap ( )
1832
1887
}
1833
1888
}
0 commit comments