@@ -141,11 +141,29 @@ deserializeFooter(footer_blob) {
141
141
142
142
const reader = new RBufferReader ( footer_blob ) ;
143
143
144
- this . footerFeatureFlags = reader . readU32 ( ) ;
145
- this . headerChecksum = reader . readU32 ( ) ;
144
+ // Read the envelope metadata
145
+ this . _readEnvelopeMetadata ( reader ) ;
146
146
147
- console . log ( 'Footer Feature Flags:' , this . footerFeatureFlags ) ;
148
- console . log ( 'Header Checksum:' , this . headerChecksum ) ;
147
+
148
+ // Feature flag(32 bits)
149
+ this . _readFeatureFlags ( reader ) ;
150
+ // Header checksum (64-bit xxhash3)
151
+ this . headerChecksum = reader . readU64 ( ) ;
152
+
153
+ const schemaExtensionSize = reader . readS64 ( ) ;
154
+
155
+ console . log ( 'Schema extension frame size:' , schemaExtensionSize ) ;
156
+ if ( schemaExtensionSize < 0 )
157
+ throw new Error ( 'Schema extension frame is not a record frame, which is unexpected.' ) ;
158
+
159
+ // Schema extension record frame (4 list frames inside)
160
+ this . _readFieldDescriptors ( reader ) ;
161
+ this . _readColumnDescriptors ( reader ) ;
162
+ this . _readAliasColumn ( reader ) ;
163
+ this . _readExtraTypeInformation ( reader ) ;
164
+
165
+ // Cluster Group record frame
166
+ this . _readClusterGroups ( reader ) ;
149
167
}
150
168
151
169
@@ -272,8 +290,8 @@ _readColumnDescriptors(reader) {
272
290
this . columnDescriptors = columnDescriptors ;
273
291
}
274
292
_readAliasColumn ( reader ) {
275
- const aliasColumnListSize = reader . readS64 ( ) ; // signed 64-bit
276
- const aliasListisList = aliasColumnListSize < 0 ;
293
+ const aliasColumnListSize = reader . readS64 ( ) ,
294
+ aliasListisList = aliasColumnListSize < 0 ;
277
295
if ( ! aliasListisList )
278
296
throw new Error ( 'Alias column list frame is not a list frame, which is required.' ) ;
279
297
const aliasColumnCount = reader . readU32 ( ) ; // number of alias column entries
@@ -292,8 +310,8 @@ _readAliasColumn(reader){
292
310
this . aliasColumns = aliasColumns ;
293
311
}
294
312
_readExtraTypeInformation ( reader ) {
295
- const extraTypeInfoListSize = reader . readS64 ( ) ; // signed 64-bit
296
- const isList = extraTypeInfoListSize < 0 ;
313
+ const extraTypeInfoListSize = reader . readS64 ( ) ,
314
+ isList = extraTypeInfoListSize < 0 ;
297
315
298
316
if ( ! isList )
299
317
throw new Error ( 'Extra type info frame is not a list frame, which is required.' ) ;
@@ -314,6 +332,34 @@ _readExtraTypeInformation(reader) {
314
332
}
315
333
this . extraTypeInfo = extraTypeInfo ;
316
334
}
335
+ _readClusterGroups ( reader ) {
336
+ const clusterGroupListSize = reader . readS64 ( ) ,
337
+ isList = clusterGroupListSize < 0 ;
338
+ if ( ! isList ) throw new Error ( 'Cluster group frame is not a list frame' ) ;
339
+
340
+ const groupCount = reader . readU32 ( ) ;
341
+ console . log ( 'Cluster Group Count:' , groupCount ) ;
342
+
343
+ const clusterGroups = [ ] ;
344
+
345
+ for ( let i = 0 ; i < groupCount ; ++ i ) {
346
+ const clusterRecordSize = reader . readS64 ( ) ,
347
+ minEntry = reader . readU64 ( ) ,
348
+ entrySpan = reader . readU64 ( ) ,
349
+ numClusters = reader . readU32 ( ) ;
350
+
351
+ console . log ( `Cluster Record Size: ${ clusterRecordSize } ` ) ;
352
+ console . log ( `Min Entry: ${ minEntry } , Entry Span: ${ entrySpan } , Num Clusters: ${ numClusters } ` ) ;
353
+
354
+ clusterGroups . push ( {
355
+ minEntry,
356
+ entrySpan,
357
+ numClusters,
358
+ } ) ;
359
+ }
360
+
361
+ this . clusterGroups = clusterGroups ;
362
+ }
317
363
318
364
}
319
365
0 commit comments