11/*
2- * Copyright 2017-2018 PixelsDB.
2+ * Copyright 2017-2023 PixelsDB.
33 *
44 * This file is part of Pixels.
55 *
@@ -27,16 +27,16 @@ package pixels.proto;
2727option java_package = "io.pixelsdb.pixels.core" ;
2828option java_outer_classname = "PixelsProto" ;
2929
30- // Row Group: A logical and horizontal partition of a table.
31- // Row group has no physical boundaries in the file.
32- // Data in a row group is stored in columns.
33- // Column Chunk: The chunk of data for a column in a row group.
34- // A column chunk is stored sequentially in the file.
35- // Pixel: Each column chunk contains a sequence of 'pixels'.
36- // Each pixel contains a number (e.g., 10000) of values.
30+ // Row Group: A logical and horizontal partition of a table. Row group has no physical boundaries in the file.
31+ // Data in a row group is stored in columns.
32+ // Column Chunk: The chunk of data for a column in a row group. A column chunk is stored sequentially in the file.
33+ // Pixel: Each column chunk contains a sequence of 'pixels'. Each pixel contains a number (e.g., 10000) of values.
3734
38- // The content of the file tail that must be serialized and stored at
39- // the end of each file, followed by 8 bytes
35+ // Layout configurations: file level configurations are in the PostScript, row group level configurations are in
36+ // the RowGroupInformation, column chunk level configurations are in the ColumnChunkIndex.
37+
38+ // The content of the file tail that must be serialized and stored at the end of each file,
39+ // followed by 8 bytes indicating the start offset of the file tail.
4040message FileTail {
4141 optional Footer footer = 1 ;
4242 optional PostScript postscript = 2 ;
@@ -45,22 +45,26 @@ message FileTail {
4545}
4646
4747// PostScript
48- // version: Pixels file version
49- // contentLength: file content length (everything except FileTail)
50- // numberOfRows: number of rows in the file
51- // compression: compression kind, currently NOT USED
52- // compressionBlockSize: compression block size, currently NOT USED
53- // pixelStride: the maximum number of rows in a pixel
54- // magic: "PIXELS"
5548message PostScript {
49+ // Pixels file version
5650 optional uint32 version = 1 ;
51+ // file content length (everything except FileTail)
5752 optional uint64 contentLength = 2 ;
53+ // number of rows in the file
5854 optional uint32 numberOfRows = 3 ;
55+ // compression kind, currently NOT USED
5956 optional CompressionKind compression = 4 ;
57+ // compression block size, currently NOT USED
6058 optional uint32 compressionBlockSize = 5 ;
59+ // the maximum number of rows in a pixel
6160 optional uint32 pixelStride = 6 ;
61+ // the timezone in which the file was written
6262 optional string writerTimezone = 7 ;
63- // Leave this last in the record
63+ // whether this is a hash partitioned file, each row group is a hash partition if it is true
64+ optional bool partitioned = 8 ;
65+ // the number of bytes the start offsets of the column chunks are align to
66+ optional uint32 columnChunkAlignment = 9 ;
67+ // it is always "PIXELS", leave this last in the record
6468 optional string magic = 8000 ;
6569}
6670
@@ -73,21 +77,16 @@ enum CompressionKind {
7377 ZSTD = 5 ;
7478}
7579
76- // Footer
77- // types: file schema
78- // columnStats: file level column statistics
79- // rowGroupInfos: row group information
80- // rowGroupStats: row group statistics
81- // partitioned: whether this is a hash partitioned file
80+ // File Footer
8281message Footer {
83- // schema
82+ // data schema of this file
8483 repeated Type types = 1 ;
8584 // file level column statistics
8685 repeated ColumnStatistic columnStats = 2 ;
86+ // row group information
8787 repeated RowGroupInformation rowGroupInfos = 3 ;
88+ // row group statistics
8889 repeated RowGroupStatistic rowGroupStats = 4 ;
89- // if the file is hash partitioned, then each row group is a hash partition.
90- optional bool partitioned = 5 ;
9190}
9291
9392message Type {
@@ -122,32 +121,30 @@ message Type {
122121
123122// The information about a data hash partition.
124123// Each row group can be used to store a hash partition of the data in the file.
125- // columnIds: the id (index in Footer.types) of the columns that are used as the partition key.
126- // hashValue: the hash value of the partition keys in this partition.
127124message PartitionInformation {
125+ // the id (index in Footer.types) of the columns that are used as the partition key
128126 repeated uint32 columnIds = 1 ;
127+ // the hash value of the partition keys in this partition
129128 optional int32 hashValue = 2 ;
130129}
131130
132- // Row group information.
133- // offset: row group start offset
134- // dataLength: row group serialized content length
135- // footerLength: serialized RowGroupFooter length
136- // numberOfRows: number of rows in this row group
137- // partitionInfo: the information of the hash partition, if Footer.partitioned is true.
131+ // Row group information
138132message RowGroupInformation {
133+ // row group start offset
139134 optional uint64 footerOffset = 1 ;
135+ // row group serialized content length
140136 optional uint32 dataLength = 2 ;
137+ // serialized RowGroupFooter length
141138 optional uint32 footerLength = 3 ;
139+ // number of rows in this row group
142140 optional uint64 numberOfRows = 4 ;
141+ // the information of the hash partition, if Footer.partitioned is true
143142 optional PartitionInformation partitionInfo = 5 ;
144143}
145144
146145// Row group statistic
147- // columnChunkStats: statistic for each column chunk.
148- // for example, min/max for col0 in this row group
149- // this can be used to filter row groups.
150146message RowGroupStatistic {
147+ // statistic for each column chunk that can be used to filter row groups
151148 repeated ColumnStatistic columnChunkStats = 1 ;
152149}
153150
@@ -229,14 +226,17 @@ message PixelStatistic {
229226}
230227
231228// ColumnChunk index
232- // pixelPositions: starting offsets of each pixel in this column chunk
233229message ColumnChunkIndex {
234- // optional ColumnStatistic columnStatistic = 1;
235230 optional uint64 chunkOffset = 1 ;
236231 optional uint64 chunkLength = 2 ;
237232 optional uint64 isNullOffset = 3 ;
233+ // starting offsets of each pixel in this column chunk
238234 repeated uint64 pixelPositions = 4 [packed =true ];
239235 repeated PixelStatistic pixelStatistics = 5 ;
236+ // whether this column chunk is stored in little endian
237+ optional bool littleEndian = 6 ;
238+ // whether the null positions are padded with arbitrary values, only used for non-encoded column chunks
239+ optional bool nullsPadded = 7 ;
240240}
241241
242242message RowGroupIndex {
0 commit comments