Class NestedPositionUtil
java.lang.Object
org.apache.flink.formats.parquet.utils.NestedPositionUtil
Utils to calculate nested type position.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CollectionPositioncalculateCollectionOffsets(ParquetField field, int[] definitionLevels, int[] repetitionLevels) Calculate the collection's offsets according to column's max repetition level, definition level, value's repetition level and definition level.static long[]calculateLengthByOffsets(boolean[] collectionIsEmpty, long[] arrayOffsets) static RowPositioncalculateRowOffsets(ParquetField field, int[] fieldDefinitionLevels, int[] fieldRepetitionLevels) Calculate row offsets according to column's max repetition level, definition level, value's repetition level and definition level.static booleanisOptionalFieldValueNull(int definitionLevel, int maxDefinitionLevel)
-
Constructor Details
-
NestedPositionUtil
public NestedPositionUtil()
-
-
Method Details
-
calculateRowOffsets
public static RowPosition calculateRowOffsets(ParquetField field, int[] fieldDefinitionLevels, int[] fieldRepetitionLevels) Calculate row offsets according to column's max repetition level, definition level, value's repetition level and definition level. Each row has three situation:- Row is not defined,because it's optional parent fields is null, this is decided by its parent's repetition level
- Row is null
- Row is defined and not empty.
- Parameters:
field- field that contains the row column message include max repetition level and definition level.fieldRepetitionLevels- int array with each value's repetition level.fieldDefinitionLevels- int array with each value's definition level.- Returns:
RowPositioncontains collections row count and isNull array.
-
calculateCollectionOffsets
public static CollectionPosition calculateCollectionOffsets(ParquetField field, int[] definitionLevels, int[] repetitionLevels) Calculate the collection's offsets according to column's max repetition level, definition level, value's repetition level and definition level. Each collection (Array or Map) has four situation:- Collection is not defined, because optional parent fields is null, this is decided by its parent's repetition level
- Collection is null
- Collection is defined but empty
- Collection is defined and not empty. In this case offset value is increased by the number of elements in that collection
- Parameters:
field- field that contains array/map column message include max repetition level and definition level.definitionLevels- int array with each value's repetition level.repetitionLevels- int array with each value's definition level.- Returns:
CollectionPositioncontains collections offset array, length array and isNull array.
-
isOptionalFieldValueNull
public static boolean isOptionalFieldValueNull(int definitionLevel, int maxDefinitionLevel) -
calculateLengthByOffsets
public static long[] calculateLengthByOffsets(boolean[] collectionIsEmpty, long[] arrayOffsets)
-