hydra-0.5.1: Type-aware transformations for data and programs
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hydra.Langs.Parquet.Format

Description

A model for the Parquet format. Based on the Thrift-based specification at: | https://github.com/apache/parquet-format/blob/master/src/main/thrift/parquet.thrift

Synopsis

Documentation

data Type Source #

Types supported by Parquet. These types are intended to be used in combination with the encodings to control the on disk storage format. For example INT16 is not included as a type since a good encoding of INT32 would handle this.

Instances

Instances details
Read Type Source # 
Instance details

Defined in Hydra.Langs.Parquet.Format

Show Type Source # 
Instance details

Defined in Hydra.Langs.Parquet.Format

Methods

showsPrec :: Int -> Type -> ShowS #

show :: Type -> String #

showList :: [Type] -> ShowS #

Eq Type Source # 
Instance details

Defined in Hydra.Langs.Parquet.Format

Methods

(==) :: Type -> Type -> Bool #

(/=) :: Type -> Type -> Bool #

Ord Type Source # 
Instance details

Defined in Hydra.Langs.Parquet.Format

Methods

compare :: Type -> Type -> Ordering #

(<) :: Type -> Type -> Bool #

(<=) :: Type -> Type -> Bool #

(>) :: Type -> Type -> Bool #

(>=) :: Type -> Type -> Bool #

max :: Type -> Type -> Type #

min :: Type -> Type -> Type #

data FieldRepetitionType Source #

Representation of Schemas

Constructors

FieldRepetitionTypeRequired

This field is required (can not be null) and each record has exactly 1 value.

FieldRepetitionTypeOptional

The field is optional (can be null) and each record has 0 or 1 values.

FieldRepetitionTypeRepeated

The field is repeated and can contain 0 or more values

data Statistics Source #

Statistics per row group and per page. All fields are optional.

Constructors

Statistics 

Fields

data DecimalType Source #

Decimal logical type annotation. To maintain forward-compatibility in v1, implementations using this logical type must also set scale and precision on the annotated SchemaElement. Allowed for physical types: INT32, INT64, FIXED, and BINARY

data TimeType Source #

Time logical type annotation. Allowed for physical types: INT32 (millis), INT64 (micros, nanos)

data IntType Source #

Integer logical type annotation. bitWidth must be 8, 16, 32, or 64. Allowed for physical types: INT32, INT64

Constructors

IntType 

Instances

Instances details
Read IntType Source # 
Instance details

Defined in Hydra.Langs.Parquet.Format

Show IntType Source # 
Instance details

Defined in Hydra.Langs.Parquet.Format

Eq IntType Source # 
Instance details

Defined in Hydra.Langs.Parquet.Format

Methods

(==) :: IntType -> IntType -> Bool #

(/=) :: IntType -> IntType -> Bool #

Ord IntType Source # 
Instance details

Defined in Hydra.Langs.Parquet.Format

data LogicalType Source #

LogicalType annotations to replace ConvertedType. To maintain compatibility, implementations using LogicalType for a SchemaElement aust also set the corresponding ConvertedType (if any) from the following table.

Constructors

LogicalTypeString

use ConvertedType UTF8

LogicalTypeMap

use ConvertedType MAP

LogicalTypeList

use ConvertedType LIST

LogicalTypeEnum

use ConvertedType ENUM

LogicalTypeDecimal DecimalType

use ConvertedType DECIMAL + SchemaElement.{scale, precision}

LogicalTypeDate

use ConvertedType DATE

LogicalTypeTime TimeType

use ConvertedType TIME_MICROS for TIME(isAdjustedToUTC = *, unit = MICROS). use ConvertedType TIME_MILLIS for TIME(isAdjustedToUTC = *, unit = MILLIS)

LogicalTypeTimestamp TimestampType

use ConvertedType TIMESTAMP_MICROS for TIMESTAMP(isAdjustedToUTC = *, unit = MICROS). use ConvertedType TIMESTAMP_MILLIS for TIMESTAMP(isAdjustedToUTC = *, unit = MILLIS)

LogicalTypeInteger IntType

use ConvertedType INT_* or UINT_*

LogicalTypeUnknown

no compatible ConvertedType

LogicalTypeJson

use ConvertedType JSON

LogicalTypeBson

use ConvertedType BSON

LogicalTypeUuid

no compatible ConvertedType

data SchemaElement Source #

Represents a element inside a schema definition. | - if it is a group (inner node) then type is undefined and num_children is defined | - if it is a primitive type (leaf) then type is defined and num_children is undefined | the nodes are listed in depth first traversal order.

Constructors

SchemaElement 

Fields

  • schemaElementType :: Maybe Type

    Data type for this field. Not set if the current element is a non-leaf node

  • schemaElementTypeLength :: Maybe Int

    If type is FIXED_LEN_BYTE_ARRAY, this is the byte length of the values. Otherwise, if specified, this is the maximum bit length to store any of the values. (e.g. a low cardinality INT col could have this set to 3). Note that this is in the schema, and therefore fixed for the entire file.

  • schemaElementRepetitionType :: Maybe FieldRepetitionType

    repetition of the field. The root of the schema does not have a repetition_type. All other nodes must have one

  • schemaElementName :: String

    Name of the field in the schema

  • schemaElementNumChildren :: Maybe Int

    Nested fields. Since thrift does not support nested fields, the nesting is flattened to a single list by a depth-first traversal. The children count is used to construct the nested relationship. This field is not set when the element is a primitive type

  • schemaElementFieldId :: Maybe Int

    When the original schema supports field ids, this will save the original field id in the parquet schema

  • schemaElementLogicalType :: Maybe LogicalType

    The logical type of this SchemaElement. LogicalType replaces ConvertedType, but ConvertedType is still required for some logical types to ensure forward-compatibility in format v1.

data Encoding Source #

Encodings supported by Parquet. Not all encodings are valid for all types. These enums are also used to specify the encoding of definition and repetition levels. See the accompanying doc for the details of the more complicated encodings.

Constructors

EncodingPlain

Default encoding. | BOOLEAN - 1 bit per value. 0 is false; 1 is true. | INT32 - 4 bytes per value. Stored as little-endian. | INT64 - 8 bytes per value. Stored as little-endian. | FLOAT - 4 bytes per value. IEEE. Stored as little-endian. | DOUBLE - 8 bytes per value. IEEE. Stored as little-endian. | BYTE_ARRAY - 4 byte length stored as little endian, followed by bytes. | FIXED_LEN_BYTE_ARRAY - Just the bytes.

EncodingRle

Group packed run length encoding. Usable for definition/repetition levels encoding and Booleans (on one bit: 0 is false; 1 is true.)

EncodingBitPacked

Bit packed encoding. This can only be used if the data has a known max width. Usable for definition/repetition levels encoding.

EncodingDeltaBinaryPacked

Delta encoding for integers. This can be used for int columns and works best on sorted data

EncodingDeltaLengthByteArray

Encoding for byte arrays to separate the length values and the data. The lengths are encoded using DELTA_BINARY_PACKED

EncodingDeltaByteArray

Incremental-encoded byte array. Prefix lengths are encoded using DELTA_BINARY_PACKED. Suffixes are stored as delta length byte arrays.

EncodingRleDictionary

Dictionary encoding: the ids are encoded using the RLE encoding

EncodingByteStreamSplit

Encoding for floating-point data. K byte-streams are created where K is the size in bytes of the data type. The individual bytes of an FP value are scattered to the corresponding stream and the streams are concatenated. This itself does not reduce the size of the data but can lead to better compression afterwards.

data CompressionCodec Source #

Supported compression algorithms. Codecs added in format version X.Y can be read by readers based on X.Y and later. Codec support may vary between readers based on the format version and libraries available at runtime. See Compression.md for a detailed specification of these algorithms.

data DataPageHeader Source #

Data page header

Constructors

DataPageHeader 

Fields

data DictionaryPageHeader Source #

The dictionary page must be placed at the first position of the column chunk if it is partly or completely dictionary encoded. At most one dictionary page can be placed in a column chunk.

Constructors

DictionaryPageHeader 

Fields

data DataPageHeaderV2 Source #

New page format allowing reading levels without decompressing the data Repetition and definition levels are uncompressed The remaining section containing the data is compressed if is_compressed is true

Constructors

DataPageHeaderV2 

Fields

data BloomFilterCompression Source #

The compression used in the Bloom filter.

data BloomFilterHeader Source #

Bloom filter header is stored at beginning of Bloom filter data of each column and followed by its bitset.

Constructors

BloomFilterHeader 

Fields

data PageHeader Source #

Constructors

PageHeader 

Fields

  • pageHeaderType :: PageType

    the type of the page: indicates which of the *_header fields is set

  • pageHeaderUncompressedPageSize :: Int

    Uncompressed page size in bytes (not including this header)

  • pageHeaderCompressedPageSize :: Int

    Compressed (and potentially encrypted) page size in bytes, not including this header

  • pageHeaderCrc :: Maybe Int

    The 32bit CRC for the page, to be be calculated as follows: | - Using the standard CRC32 algorithm | - On the data only, i.e. this header should not be included. Data | hereby refers to the concatenation of the repetition levels, the | definition levels and the column value, in this exact order. | - On the encoded versions of the repetition levels, definition levels and | column values | - On the compressed versions of the repetition levels, definition levels | and column values where possible; | - For v1 data pages, the repetition levels, definition levels and column | values are always compressed together. If a compression scheme is | specified, the CRC shall be calculated on the compressed version of | this concatenation. If no compression scheme is specified, the CRC | shall be calculated on the uncompressed version of this concatenation. | - For v2 data pages, the repetition levels and definition levels are | handled separately from the data and are never compressed (only | encoded). If a compression scheme is specified, the CRC shall be | calculated on the concatenation of the uncompressed repetition levels, | uncompressed definition levels and the compressed column values. | If no compression scheme is specified, the CRC shall be calculated on | the uncompressed concatenation. | - In encrypted columns, CRC is calculated after page encryption; the | encryption itself is performed after page compression (if compressed) | If enabled, this allows for disabling checksumming in HDFS if only a few pages need to be read.

  • pageHeaderDataPageHeader :: Maybe DataPageHeader
     
  • pageHeaderIndexPageHeader :: Maybe IndexPageHeader
     
  • pageHeaderDictionaryPageHeader :: Maybe DictionaryPageHeader
     
  • pageHeaderDataPageHeaderV2 :: Maybe DataPageHeaderV2
     

data KeyValue Source #

Wrapper struct to store key values

Constructors

KeyValue 

data SortingColumn Source #

Wrapper struct to specify sort order

Constructors

SortingColumn 

Fields

data PageEncodingStats Source #

statistics of a given page type and encoding

Constructors

PageEncodingStats 

Fields

data ColumnMetaData Source #

Description for column metadata

Constructors

ColumnMetaData 

Fields

data EncryptionWithColumnKey Source #

Constructors

EncryptionWithColumnKey 

Fields

data ColumnCryptoMetaData Source #

data ColumnChunk Source #

Constructors

ColumnChunk 

Fields

data RowGroup Source #

Constructors

RowGroup 

Fields

data ColumnOrder Source #

Union to specify the order used for the min_value and max_value fields for a column. This union takes the role of an enhanced enum that allows rich elements (which will be needed for a collation-based ordering in the future). Possible values are: | * TypeDefinedOrder - the column uses the order defined by its logical or physical type (if there is no logical type). | If the reader does not support the value of this union, min and max stats for this column should be ignored.

Constructors

ColumnOrderTypeOrder

The sort orders for logical types are: | UTF8 - unsigned byte-wise comparison | INT8 - signed comparison | INT16 - signed comparison | INT32 - signed comparison | INT64 - signed comparison | UINT8 - unsigned comparison | UINT16 - unsigned comparison | UINT32 - unsigned comparison | UINT64 - unsigned comparison | DECIMAL - signed comparison of the represented value | DATE - signed comparison | TIME_MILLIS - signed comparison | TIME_MICROS - signed comparison | TIMESTAMP_MILLIS - signed comparison | TIMESTAMP_MICROS - signed comparison | INTERVAL - unsigned comparison | JSON - unsigned byte-wise comparison | BSON - unsigned byte-wise comparison | ENUM - unsigned byte-wise comparison | LIST - undefined | MAP - undefined | In the absence of logical types, the sort order is determined by the physical type: | BOOLEAN - false, true | INT32 - signed comparison | INT64 - signed comparison | INT96 (only used for legacy timestamps) - undefined | FLOAT - signed comparison of the represented value (*) | DOUBLE - signed comparison of the represented value (*) | BYTE_ARRAY - unsigned byte-wise comparison | FIXED_LEN_BYTE_ARRAY - unsigned byte-wise comparison | (*) Because the sorting order is not specified properly for floating | point values (relations vs. total ordering) the following | compatibility rules should be applied when reading statistics: | - If the min is a NaN, it should be ignored. | - If the max is a NaN, it should be ignored. | - If the min is +0, the row group may contain -0 values as well. | - If the max is -0, the row group may contain +0 values as well. | - When looking for NaN values, min and max should be ignored.

data PageLocation Source #

Constructors

PageLocation 

Fields

data OffsetIndex Source #

Constructors

OffsetIndex 

Fields

  • offsetIndexPageLocations :: [PageLocation]

    PageLocations, ordered by increasing PageLocation.offset. It is required that page_locations[i].first_row_index < page_locations[i+1].first_row_index.

data ColumnIndex Source #

Description for ColumnIndex. Each array-field[i] refers to the page at OffsetIndex.page_locations[i]

Constructors

ColumnIndex 

Fields

  • columnIndexNullPages :: [Bool]

    A list of Boolean values to determine the validity of the corresponding min and max values. If true, a page contains only null values, and writers have to set the corresponding entries in min_values and max_values to byte[0], so that all lists have the same length. If false, the corresponding entries in min_values and max_values must be valid.

  • columnIndexMinValues :: [String]

    minValues and maxValues are lists containing lower and upper bounds for the values of each page determined by the ColumnOrder of the column. These may be the actual minimum and maximum values found on a page, but can also be (more compact) values that do not exist on a page. For example, instead of storing "Blart Versenwald III", a writer may set min_values[i]=B, max_values[i]=C. Such more compact values must still be valid values within the column's logical type. Readers must make sure that list entries are populated before using them by inspecting null_pages.

  • columnIndexMaxValues :: [String]
     
  • columnIndexBoundaryOrder :: BoundaryOrder

    Stores whether both min_values and max_values are orderd and if so, in which direction. This allows readers to perform binary searches in both lists. Readers cannot assume that max_values[i] <= min_values[i+1], even if the lists are ordered.

  • columnIndexNullCounts :: Maybe [Int64]

    A list containing the number of null values for each page

data AesGcmV1 Source #

Constructors

AesGcmV1 

Fields

data AesGcmCtrV1 Source #

Constructors

AesGcmCtrV1 

Fields

data FileMetaData Source #

Description for file metadata

Constructors

FileMetaData 

Fields

  • fileMetaDataVersion :: Int

    Version of this file

  • fileMetaDataSchema :: [SchemaElement]

    Parquet schema for this file. This schema contains metadata for all the columns. The schema is represented as a tree with a single root. The nodes of the tree are flattened to a list by doing a depth-first traversal. The column metadata contains the path in the schema for that column which can be used to map columns to nodes in the schema. The first element is the root

  • fileMetaDataNumRows :: Int64

    Number of rows in this file

  • fileMetaDataRowGroups :: [RowGroup]

    Row groups in this file

  • fileMetaDataKeyValueMetadata :: Maybe [KeyValue]

    Optional key/value metadata

  • fileMetaDataCreatedBy :: Maybe String

    String for application that wrote this file. This should be in the format Application version Version (build Build Hash). e.g. impala version 1.0 (build 6cf94d29b2b7115df4de2c06e2ab4326d721eb55)

  • fileMetaDataColumnOrders :: Maybe [ColumnOrder]

    Sort order used for the min_value and max_value fields in the Statistics objects and the min_values and max_values fields in the ColumnIndex objects of each column in this file. Sort orders are listed in the order matching the columns in the schema. The indexes are not necessary the same though, because only leaf nodes of the schema are represented in the list of sort orders. | Without column_orders, the meaning of the min_value and max_value fields in the Statistics object and the ColumnIndex object is undefined. To ensure well-defined behaviour, if these fields are written to a Parquet file, column_orders must be written as well. | The obsolete min and max fields in the Statistics object are always sorted by signed comparison regardless of column_orders.

  • fileMetaDataEncryptionAlgorithm :: Maybe EncryptionAlgorithm

    Encryption algorithm. This field is set only in encrypted files with plaintext footer. Files with encrypted footer store algorithm id in FileCryptoMetaData structure.

  • fileMetaDataFooterSigningKeyMetadata :: Maybe String

    Retrieval metadata of key used for signing the footer. Used only in encrypted files with plaintext footer.

data FileCryptoMetaData Source #

Crypto metadata for files with encrypted footer

Constructors

FileCryptoMetaData 

Fields