@@ -90,54 +90,38 @@ mod tests {
9090 use indexmap:: IndexMap ;
9191
9292 use super :: * ;
93+ use crate :: spec:: DeletionVectorMeta ;
9394
9495 #[ test]
9596 fn test_read_index_manifest_file ( ) {
9697 let workdir =
9798 std:: env:: current_dir ( ) . unwrap_or_else ( |err| panic ! ( "current_dir must exist: {err}" ) ) ;
9899 let path = workdir
99- . join ( "tests/fixtures/manifest/index-manifest-85cc6729-f5af-431a-a1c3-ef45319328fb -0" ) ;
100+ . join ( "tests/fixtures/manifest/index-manifest-7e816ed9-9f3b-4786-9985-8937d4e07b6e -0" ) ;
100101 let source = std:: fs:: read ( path. to_str ( ) . unwrap ( ) ) . unwrap ( ) ;
101- let mut reader =
102- serde_avro_fast:: object_container_file_encoding:: Reader :: from_slice ( source. as_slice ( ) )
103- . unwrap ( ) ;
104- let res: Vec < _ > = reader
105- . deserialize :: < IndexManifestEntry > ( )
106- . collect :: < Result < _ , _ > > ( )
107- . unwrap ( ) ;
102+ let res = IndexManifest :: read_from_bytes ( & source) . unwrap ( ) ;
108103 assert_eq ! (
109104 res,
110- vec![
111- IndexManifestEntry {
112- version: 1 ,
113- kind: FileKind :: Add ,
114- partition: vec![ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
115- bucket: 0 ,
116- index_file: IndexFileMeta {
117- index_type: "HASH" . into( ) ,
118- file_name: "index-a984b43a-c3fb-40b4-ad29-536343c239a6-0" . into( ) ,
119- file_size: 16 ,
120- row_count: 4 ,
121- deletion_vectors_ranges: None ,
122- }
123- } ,
124- IndexManifestEntry {
125- version: 1 ,
126- kind: FileKind :: Add ,
127- partition: vec![ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
128- bucket: 0 ,
129- index_file: IndexFileMeta {
130- index_type: "DELETION_VECTORS" . into( ) ,
131- file_name: "index-3f0986c5-4398-449b-be82-95f019d7a748-0" . into( ) ,
132- file_size: 33 ,
133- row_count: 1 ,
134- deletion_vectors_ranges: Some ( IndexMap :: from( [ (
135- "data-9b76122c-6bb5-4952-a946-b5bce29694a1-0.orc" . into( ) ,
136- ( 1 , 24 )
137- ) ] ) ) ,
138- }
105+ vec![ IndexManifestEntry {
106+ version: 1 ,
107+ kind: FileKind :: Add ,
108+ partition: vec![ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ,
109+ bucket: 0 ,
110+ index_file: IndexFileMeta {
111+ index_type: "DELETION_VECTORS" . into( ) ,
112+ file_name: "index-4326356b-aad7-4fd8-9d88-2bb6993c8ce9-0" . into( ) ,
113+ file_size: 35 ,
114+ row_count: 1 ,
115+ deletion_vectors_ranges: Some ( IndexMap :: from( [ (
116+ "data-a989fc44-a361-42c2-801f-e50baba95a92-0.parquet" . into( ) ,
117+ DeletionVectorMeta {
118+ offset: 1 ,
119+ length: 26 ,
120+ cardinality: Some ( 3 ) ,
121+ }
122+ ) ] ) ) ,
139123 }
140- ]
124+ } ]
141125 ) ;
142126 }
143127
@@ -153,7 +137,14 @@ mod tests {
153137 file_name : "test1" . into ( ) ,
154138 file_size : 33 ,
155139 row_count : 1 ,
156- deletion_vectors_ranges : Some ( IndexMap :: from ( [ ( "test1" . into ( ) , ( 1 , 24 ) ) ] ) ) ,
140+ deletion_vectors_ranges : Some ( IndexMap :: from ( [ (
141+ "test1" . into ( ) ,
142+ DeletionVectorMeta {
143+ offset : 1 ,
144+ length : 24 ,
145+ cardinality : Some ( 7 ) ,
146+ } ,
147+ ) ] ) ) ,
157148 } ,
158149 } ;
159150
@@ -180,7 +171,8 @@ mod tests {
180171 "fields": [
181172 {"name": "f0", "type": "string"},
182173 {"name": "f1", "type": "int"},
183- {"name": "f2", "type": "int"}
174+ {"name": "f2", "type": "int"},
175+ {"name": "_CARDINALITY", "type": ["null", "long"], "default": null}
184176 ]
185177 }]
186178 }]
0 commit comments