@@ -67,7 +67,7 @@ pub(crate) const DOMAIN_METADATA_NAME: &str = "domainMetadata";
6767
6868pub ( crate ) const INTERNAL_DOMAIN_PREFIX : & str = "delta." ;
6969
70- static LOG_SCHEMA : LazyLock < SchemaRef > = LazyLock :: new ( || {
70+ static COMMIT_SCHEMA : LazyLock < SchemaRef > = LazyLock :: new ( || {
7171 Arc :: new ( StructType :: new_unchecked ( [
7272 StructField :: nullable ( ADD_NAME , Add :: to_schema ( ) ) ,
7373 StructField :: nullable ( REMOVE_NAME , Remove :: to_schema ( ) ) ,
@@ -76,17 +76,16 @@ static LOG_SCHEMA: LazyLock<SchemaRef> = LazyLock::new(|| {
7676 StructField :: nullable ( SET_TRANSACTION_NAME , SetTransaction :: to_schema ( ) ) ,
7777 StructField :: nullable ( COMMIT_INFO_NAME , CommitInfo :: to_schema ( ) ) ,
7878 StructField :: nullable ( CDC_NAME , Cdc :: to_schema ( ) ) ,
79- StructField :: nullable ( CHECKPOINT_METADATA_NAME , CheckpointMetadata :: to_schema ( ) ) ,
8079 StructField :: nullable ( DOMAIN_METADATA_NAME , DomainMetadata :: to_schema ( ) ) ,
8180 ] ) )
8281} ) ;
8382
8483static ALL_ACTIONS_SCHEMA : LazyLock < SchemaRef > = LazyLock :: new ( || {
8584 Arc :: new ( StructType :: new_unchecked (
86- get_log_schema ( )
87- . fields ( )
88- . cloned ( )
89- . chain ( [ StructField :: nullable ( SIDECAR_NAME , Sidecar :: to_schema ( ) ) ] ) ,
85+ get_commit_schema ( ) . fields ( ) . cloned ( ) . chain ( [
86+ StructField :: nullable ( CHECKPOINT_METADATA_NAME , CheckpointMetadata :: to_schema ( ) ) ,
87+ StructField :: nullable ( SIDECAR_NAME , Sidecar :: to_schema ( ) ) ,
88+ ] ) ,
9089 ) )
9190} ) ;
9291
@@ -121,8 +120,8 @@ static LOG_DOMAIN_METADATA_SCHEMA: LazyLock<SchemaRef> = LazyLock::new(|| {
121120#[ internal_api]
122121/// Gets the schema for all actions that can appear in commits
123122/// logs. This excludes actions that can only appear in checkpoints.
124- pub ( crate ) fn get_log_schema ( ) -> & ' static SchemaRef {
125- & LOG_SCHEMA
123+ pub ( crate ) fn get_commit_schema ( ) -> & ' static SchemaRef {
124+ & COMMIT_SCHEMA
126125}
127126
128127#[ internal_api]
@@ -1047,7 +1046,7 @@ mod tests {
10471046
10481047 #[ test]
10491048 fn test_metadata_schema ( ) {
1050- let schema = get_log_schema ( )
1049+ let schema = get_commit_schema ( )
10511050 . project ( & [ METADATA_NAME ] )
10521051 . expect ( "Couldn't get metaData field" ) ;
10531052
@@ -1081,7 +1080,7 @@ mod tests {
10811080
10821081 #[ test]
10831082 fn test_add_schema ( ) {
1084- let schema = get_log_schema ( )
1083+ let schema = get_commit_schema ( )
10851084 . project ( & [ ADD_NAME ] )
10861085 . expect ( "Couldn't get add field" ) ;
10871086
@@ -1139,7 +1138,7 @@ mod tests {
11391138
11401139 #[ test]
11411140 fn test_remove_schema ( ) {
1142- let schema = get_log_schema ( )
1141+ let schema = get_commit_schema ( )
11431142 . project ( & [ REMOVE_NAME ] )
11441143 . expect ( "Couldn't get remove field" ) ;
11451144 let expected = Arc :: new ( StructType :: new_unchecked ( [ StructField :: nullable (
@@ -1162,7 +1161,7 @@ mod tests {
11621161
11631162 #[ test]
11641163 fn test_cdc_schema ( ) {
1165- let schema = get_log_schema ( )
1164+ let schema = get_commit_schema ( )
11661165 . project ( & [ CDC_NAME ] )
11671166 . expect ( "Couldn't get cdc field" ) ;
11681167 let expected = Arc :: new ( StructType :: new_unchecked ( [ StructField :: nullable (
@@ -1195,7 +1194,7 @@ mod tests {
11951194
11961195 #[ test]
11971196 fn test_checkpoint_metadata_schema ( ) {
1198- let schema = get_log_schema ( )
1197+ let schema = get_all_actions_schema ( )
11991198 . project ( & [ CHECKPOINT_METADATA_NAME ] )
12001199 . expect ( "Couldn't get checkpointMetadata field" ) ;
12011200 let expected = Arc :: new ( StructType :: new_unchecked ( [ StructField :: nullable (
@@ -1210,7 +1209,7 @@ mod tests {
12101209
12111210 #[ test]
12121211 fn test_transaction_schema ( ) {
1213- let schema = get_log_schema ( )
1212+ let schema = get_commit_schema ( )
12141213 . project ( & [ "txn" ] )
12151214 . expect ( "Couldn't get transaction field" ) ;
12161215
@@ -1227,7 +1226,7 @@ mod tests {
12271226
12281227 #[ test]
12291228 fn test_commit_info_schema ( ) {
1230- let schema = get_log_schema ( )
1229+ let schema = get_commit_schema ( )
12311230 . project ( & [ "commitInfo" ] )
12321231 . expect ( "Couldn't get commitInfo field" ) ;
12331232
@@ -1251,7 +1250,7 @@ mod tests {
12511250
12521251 #[ test]
12531252 fn test_domain_metadata_schema ( ) {
1254- let schema = get_log_schema ( )
1253+ let schema = get_commit_schema ( )
12551254 . project ( & [ DOMAIN_METADATA_NAME ] )
12561255 . expect ( "Couldn't get domainMetadata field" ) ;
12571256 let expected = Arc :: new ( StructType :: new_unchecked ( [ StructField :: nullable (
@@ -1789,9 +1788,9 @@ mod tests {
17891788 let metadata_id = metadata. id . clone ( ) ;
17901789
17911790 // test with the full log schema that wraps metadata in a "metaData" field
1792- let log_schema = get_log_schema ( ) . project ( & [ METADATA_NAME ] ) . unwrap ( ) ;
1791+ let commit_schema = get_commit_schema ( ) . project ( & [ METADATA_NAME ] ) . unwrap ( ) ;
17931792 let actual: RecordBatch = metadata
1794- . into_engine_data ( log_schema , & engine)
1793+ . into_engine_data ( commit_schema , & engine)
17951794 . unwrap ( )
17961795 . into_any ( )
17971796 . downcast :: < ArrowEngineData > ( )
@@ -1886,8 +1885,8 @@ mod tests {
18861885 assert_eq ! ( record_batch, expected) ;
18871886
18881887 // test with the full log schema that wraps protocol in a "protocol" field
1889- let log_schema = get_log_schema ( ) . project ( & [ PROTOCOL_NAME ] ) . unwrap ( ) ;
1890- let engine_data = protocol. into_engine_data ( log_schema , & engine) ;
1888+ let commit_schema = get_commit_schema ( ) . project ( & [ PROTOCOL_NAME ] ) . unwrap ( ) ;
1889+ let engine_data = protocol. into_engine_data ( commit_schema , & engine) ;
18911890
18921891 let schema = Arc :: new ( Schema :: new ( vec ! [ Field :: new(
18931892 "protocol" ,
@@ -1996,7 +1995,7 @@ mod tests {
19961995
19971996 #[ test]
19981997 fn test_schema_contains_file_actions_with_add ( ) {
1999- let schema = get_log_schema ( )
1998+ let schema = get_commit_schema ( )
20001999 . project ( & [ ADD_NAME , PROTOCOL_NAME ] )
20012000 . unwrap ( ) ;
20022001 assert ! ( schema_contains_file_actions( & schema) ) ;
@@ -2007,7 +2006,7 @@ mod tests {
20072006
20082007 #[ test]
20092008 fn test_schema_contains_file_actions_with_remove ( ) {
2010- let schema = get_log_schema ( )
2009+ let schema = get_commit_schema ( )
20112010 . project ( & [ REMOVE_NAME , METADATA_NAME ] )
20122011 . unwrap ( ) ;
20132012 assert ! ( schema_contains_file_actions( & schema) ) ;
@@ -2018,13 +2017,15 @@ mod tests {
20182017
20192018 #[ test]
20202019 fn test_schema_contains_file_actions_with_both ( ) {
2021- let schema = get_log_schema ( ) . project ( & [ ADD_NAME , REMOVE_NAME ] ) . unwrap ( ) ;
2020+ let schema = get_commit_schema ( )
2021+ . project ( & [ ADD_NAME , REMOVE_NAME ] )
2022+ . unwrap ( ) ;
20222023 assert ! ( schema_contains_file_actions( & schema) ) ;
20232024 }
20242025
20252026 #[ test]
20262027 fn test_schema_contains_file_actions_with_neither ( ) {
2027- let schema = get_log_schema ( )
2028+ let schema = get_commit_schema ( )
20282029 . project ( & [ PROTOCOL_NAME , METADATA_NAME ] )
20292030 . unwrap ( ) ;
20302031 assert ! ( !schema_contains_file_actions( & schema) ) ;
0 commit comments