findepi commented on code in PR #69: URL: https://github.com/apache/iceberg-docs/pull/69#discussion_r841789825
########## landing-page/content/common/statistics-format-spec.md: ########## @@ -0,0 +1,111 @@ +--- +url: statistics-format +toc: false +--- +<!-- + - Licensed to the Apache Software Foundation (ASF) under one or more + - contributor license agreements. See the NOTICE file distributed with + - this work for additional information regarding copyright ownership. + - The ASF licenses this file to You under the Apache License, Version 2.0 + - (the "License"); you may not use this file except in compliance with + - the License. You may obtain a copy of the License at + - + - http://www.apache.org/licenses/LICENSE-2.0 + - + - Unless required by applicable law or agreed to in writing, software + - distributed under the License is distributed on an "AS IS" BASIS, + - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + - See the License for the specific language governing permissions and + - limitations under the License. + --> + +# Plain Format for Iceberg Statistics + +This is a specification for the Plain Format for Iceberg Statistics, a file +format designed to store information such as statistics about data managed in an +Iceberg table that cannot be stored directly within the Iceberg manifest. A +statistics file contains arbitrary pieces of information (here called "blobs"), +along with metadata necessary to interpret them. + +## Format specification + +A file conforming to the format specification should have the structure as +described below. + +### File structure + +The file has the following structure + +``` +Magic Blob₁ Blob₂ ... Blobₙ Footer +``` + +where + +- `Magic` is four bytes 0x80, 0x70, 0x73, 0x83 (short for: Plain Format for + Iceberg Statistics), +- `Blobᵢ` is i-th blob contained in the file, to be interpreted by application + according to the footer, +- `Footer` is defined below. + +### Footer structure Review Comment: > Header-based formats are simpler because you don't need to do calculations to find where the footer starts i agree, especially for the reader implementation. (the footer-based approach is actually _simpler_ for writer; so i guess one side needs to be less happy) > Seeks to the end of the file and then backward seeks to get content are expensive I agree. With header, you either assume some size of it, or you need to read/know header length. If you know the length, you do a range request, and then header/footer doesn't matter, does it? i intended for the footer size to be stored together with the file path and size for this purpose > All of the blobs will be pre-computed and will likely be in memory or in other files already because they were aggregated from an incoming data stream that's a reasonable assumption for today. I can imagine writing header instead of footer would require buffering whole writes in memory, so it would increase memory usage by up to 100% (blobs are compressed, so you will likely keep original data and the compressed form in memory during writes). This probably isn't a problem. However, this also adds scalability limits, or usability limits for the format. For example, with footer-based approach i can process the stats files in a steaming fashion (eg (re)compress the blobs, or write stats as I collect them, perhaps reducing memory footprint on the coordinator node). Now, I am not saying this is a problem, I don't know if it will be. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
