Skip to content

Commit 5f4b18c

Browse files
committed
clean up some comments
1 parent e3ac980 commit 5f4b18c

File tree

1 file changed

+7
-2
lines changed
  • parquet/src/file/metadata/thrift

1 file changed

+7
-2
lines changed

parquet/src/file/metadata/thrift/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,16 @@ fn convert_stats(
331331
})
332332
}
333333

334+
// bit positions for required fields in the Thrift ColumnMetaData struct
334335
const COL_META_TYPE: u16 = 1 << 1;
335336
const COL_META_ENCODINGS: u16 = 1 << 2;
336337
const COL_META_CODEC: u16 = 1 << 4;
337338
const COL_META_NUM_VALUES: u16 = 1 << 5;
338339
const COL_META_TOTAL_UNCOMP_SZ: u16 = 1 << 6;
339340
const COL_META_TOTAL_COMP_SZ: u16 = 1 << 7;
340341
const COL_META_DATA_PAGE_OFFSET: u16 = 1 << 9;
342+
343+
// a mask where all required fields' bits are set
341344
const COL_META_ALL_REQUIRED: u16 = COL_META_TYPE
342345
| COL_META_ENCODINGS
343346
| COL_META_CODEC
@@ -346,9 +349,10 @@ const COL_META_ALL_REQUIRED: u16 = COL_META_TYPE
346349
| COL_META_TOTAL_COMP_SZ
347350
| COL_META_DATA_PAGE_OFFSET;
348351

352+
// check mask to see if all required fields are set. return an appropriate error if
353+
// any are missing.
349354
fn validate_column_metadata(mask: u16) -> Result<()> {
350355
if mask != COL_META_ALL_REQUIRED {
351-
// not encrypted, so meta_data better exist
352356
if mask & COL_META_ENCODINGS == 0 {
353357
return Err(general_err!("Required field encodings is missing"));
354358
}
@@ -376,14 +380,15 @@ fn validate_column_metadata(mask: u16) -> Result<()> {
376380
Ok(())
377381
}
378382

383+
// Decode `ColumnMetaData`. Returns a mask of all required fields that were observed.
384+
// This mask can be passed to `validate_column_metadata`.
379385
fn read_column_metadata<'a>(
380386
prot: &mut ThriftSliceInputProtocol<'a>,
381387
column: &mut ColumnChunkMetaData,
382388
) -> Result<u16> {
383389
// mask for seen required fields in ColumnMetaData
384390
let mut seen_mask = 0u16;
385391

386-
// `ColumnMetaData`. Read inline for performance sake.
387392
// struct ColumnMetaData {
388393
// 1: required Type type
389394
// 2: required list<Encoding> encodings

0 commit comments

Comments
 (0)