<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Aditya on Medium]]></title>
        <description><![CDATA[Stories by Aditya on Medium]]></description>
        <link>https://medium.com/@adityaashokan.kantar?source=rss-517fe8f71a17------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*7hBsQniv1T48J9EA</url>
            <title>Stories by Aditya on Medium</title>
            <link>https://medium.com/@adityaashokan.kantar?source=rss-517fe8f71a17------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 16:10:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@adityaashokan.kantar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Apache Iceberg -Hidden Partitioning]]></title>
            <link>https://medium.com/@adityaashokan.kantar/apache-iceberg-hidden-partitioning-682cc4ab6776?source=rss-517fe8f71a17------2</link>
            <guid isPermaLink="false">https://medium.com/p/682cc4ab6776</guid>
            <category><![CDATA[apache-iceberg]]></category>
            <category><![CDATA[apache-spark]]></category>
            <category><![CDATA[partitioning]]></category>
            <dc:creator><![CDATA[Aditya]]></dc:creator>
            <pubDate>Mon, 11 Aug 2025 17:47:04 GMT</pubDate>
            <atom:updated>2025-08-20T14:54:32.464Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n_BdaH308un9mhYLt9jwLg.png" /></figure><p>In the world of big data, performance often hinges on one deceptively simple concept: <strong>partitioning</strong>. Partition your data well, and your queries fly. Get it wrong or forget to use it and even the best-engineered pipelines can crawl to a halt.</p><p>Consider this scenario: the data team modifies the partition column of a critical sales dataset perhaps renaming it or switching from daily to hourly partitions. Without proper abstractions, this change ripples through the analytics ecosystem. Dashboards that once refreshed in seconds now time out, queries scan far more data than necessary, and stakeholders lose confidence in the data platform.</p><p><strong>Apache Iceberg</strong>, a modern open-source table format, offers a robust solution: <strong>hidden partitioning</strong>. By abstracting partition details away from users and query engines, Iceberg enables partition optimisations that are invisible to analysts and downstream applications. This decoupling dramatically reduces operational risk, improves query performance, and simplifies data management.</p><h3><strong>When Partitioning Becomes a Liability</strong></h3><p>In traditional data lakes, partitioning is a way to organise data <strong>physically</strong> on disk by the values of one or more columns. It’s especially common in file formats like <strong>Parquet</strong>, <strong>ORC</strong>, and table layers like <strong>Hive Metastore</strong>.</p><p>To understand how fragile this can be in practice, let’s consider a real-world example with a sales dataset. Let’s say we have a sales dataset partitioned by event_date and the files are stored in directories like:</p><pre>/sales/event_date=2025-06-01/<br>/sales/event_date=2025-06-02/<br>/sales/event_date=2025-06-03/</pre><p>when a query includes a filter like:</p><pre>SELECT * FROM sales WHERE event_date = &#39;2025-06-01&#39;;</pre><p>the engine (Spark, Hive, Presto, etc.) can <strong>prune</strong> irrelevant directories and read only the matching folder(s). This is known as <strong>partition pruning</strong>. To get that performance, users <strong>must know</strong> and <strong>filter on</strong> the partition column (event_date in this case).</p><p>If they write:</p><pre>SELECT * FROM sales WHERE CAST(ts AS DATE) = &#39;2025-06-01&#39;;</pre><p>or forget the filter altogether, the engine will scan <strong>all files</strong>, which kills performance.</p><p><strong><em>Key Problems:</em></strong></p><ul><li><strong>Query Fragility</strong>: Queries must be written with deep knowledge of partitioning.</li><li><strong>Schema Coupling</strong>: Renaming or transforming a partition column can break dashboards.</li><li><strong>Rigid Optimisations</strong>: Changing partitioning requires costly rewrites and coordination.</li><li><strong>No Logical Transformations</strong>: Partitioning by month(ts) or bucket(user_id) requires exposing transformed columns.</li></ul><p>This is where <strong>Iceberg’s hidden partitioning</strong> shines it decouples partitioning logic from the user query layer.</p><h3>Under the Hood of Apache Iceberg Architecture</h3><p><strong>Apache Iceberg </strong>is a high-performance<strong> </strong>open-source table format originally developed by Netflix<strong> </strong>to handle petabyte-scale analytic datasets<strong>.</strong> It brings the familiarity and reliability of SQL tables to the world of big data, while enabling multiple engines like Spark, Trino, Flink, Presto, Hive, and Impala to safely read and write to the same tables concurrently.</p><p>At its core, Iceberg <strong>decouples the physical layout of data from how it is queried</strong>. In traditional systems, the way data is partitioned and stored directly affects how it must be queried. This tight coupling creates fragility, as any change in the underlying partitioning logic risks breaking downstream queries, dashboards, or pipelines. Iceberg solves this by introducing an abstraction layer that separates <strong>storage optimisations from user-facing query logic</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SRo-wjg2BZYeBzypu-gkzw.png" /><figcaption>Image Credit: Apache Iceberg Documentation</figcaption></figure><p>Apache Iceberg is built on a <strong>modular three-layer architecture</strong> that separates metadata management from physical data storage. This design ensures high scalability, schema evolution support, and efficient query execution.</p><p>Iceberg’s architecture is composed of the following layers:</p><ol><li><strong>Catalog Layer</strong></li><li><strong>Metadata Layer</strong></li><li><strong>Data Layer</strong></li></ol><h4>Catalog Layer</h4><p>The <strong>catalog layer</strong> serves as the entry point for interacting with Iceberg tables. It manages table references and provides the location of the latest metadata file for a given table.</p><ul><li><strong>Purpose:</strong> Maps fully qualified table names (e.g., sales.orders) to their current metadata file.</li><li><strong>Examples of implementations:</strong> Hive Metastore, AWS Glue.</li><li><strong>Functionality:</strong> Supports transactional consistency and multi-engine interoperability by exposing consistent metadata views to querying engines.</li></ul><h4>Metadata Layer</h4><p>The <strong>metadata layer</strong> is the core of Iceberg’s architectural innovation. It stores all the information needed to track table versions, partitioning, and data file locations, independent of physical layout.</p><h4>Key Components:</h4><ul><li><strong>Metadata File:</strong> Contains table schema, partition spec, and snapshot pointers.</li><li><strong>Snapshot:</strong> Represents a consistent state of the table at a point in time.</li><li><strong>Manifest List:</strong> Points to the manifest files associated with a snapshot.</li><li><strong>Manifest File:</strong> Stores metadata about data files, including: Partition values, File statistics (e.g., min/max values), Flags for added or deleted files</li></ul><h4>Data Layer</h4><p>The <strong>data layer</strong> consists of the actual immutable data files stored in open file formats.</p><ul><li><strong>Common formats:</strong> Parquet, Avro, ORC</li><li><strong>Storage backends:</strong> Cloud object stores (S3, GCS, Azure), HDFS</li><li><strong>Organisation:</strong> Files are referenced via manifest files no reliance on directory structure for partitioning</li></ul><h3>How Iceberg Makes Partitioning Invisible and Powerful</h3><p>Unlike traditional data lakes that expose partitioning as a physical structure (e.g., directory paths like /year=2025/month=06/), Iceberg treats partitioning as <em>metadata</em>, making it <strong>invisible to the user</strong> but still <strong>highly optimised</strong> under the hood. Let’s walk through how this works when a query engine executes a simple SELECT on an Iceberg table:</p><p><strong><em>Resolving the Table’s Metadata<br></em></strong>When a SELECT query starts, the query engine doesn’t immediately touch the data. Instead, it contacts the <strong>Iceberg catalog</strong>, which acts as a central registry. This catalog provides the <strong>location of the current metadata file</strong> for the table.</p><p><strong><em>Identifying the Active Snapshot<br></em></strong>Once the engine opens the metadata file, it reads the value of current-snapshot-id. This ID points to a specific <strong>snapshot</strong> in the snapshots array essentially a version of the table at a given point in time.</p><p>Each snapshot contains a pointer to a <strong>manifest list</strong>, which is a file that holds references to multiple <strong>manifest files</strong>. These manifest files are the key to partition pruning and data skipping.</p><p><strong><em>Reading the Manifest List<br></em></strong>With the manifest list open, the engine now has a map of all the manifest files that belong to the snapshot. Each manifest file summarizes a subset of the data files what partitions they belong to, how many rows they have, and basic statistics like min/max values of columns.</p><p>This is where Iceberg starts to shine. Using this rich metadata, the engine can <strong>eliminate entire manifests</strong> or <strong>skip files</strong> that are irrelevant to the query. This is <strong>partition pruning</strong>, and it’s done <em>without the user needing to know anything about the underlying partitions</em>.</p><p><strong><em>Loading the Relevant Data Files<br></em></strong>After filtering the manifest files, the engine then reads the file-path entries in the remaining manifest files. These entries point to the <strong>actual data files</strong>, usually stored in formats like Parquet or Avro.</p><p>Creating a table with iceberg Partitioning</p><pre>CREATE TABLE orders (<br>    order_id BIGINT,<br>    customer_id BIGINT,<br>    order_amount DECIMAL(10, 2),<br>    order_ts TIMESTAMP<br>)<br>USING iceberg<br>PARTITIONED BY ( HOUR(order_ts) );</pre><p>Above, we created a table called orders. The table has 4 columns and is partitioned at the <em>hour</em> level, meaning each data file corresponds to a specific hour of order_ts.</p><p>Now lets add some data</p><pre>INSERT INTO orders VALUES (<br>    123,<br>    456,<br>    36.17,<br>    &#39;2025-01-16 05:51:28&#39;<br>);</pre><p>Now, suppose a user runs the following query to fetch all records from January 16, 2025:</p><pre>SELECT *<br>FROM orders<br>WHERE order_ts = DATE &#39;2025-01-16&#39;</pre><p>Recall that when we created the table, we partitioned it at the hour-level of the timestamp of when the order first occurred. In Hive, this query generally causes a full table scan. However, with Iceberg, users are not required to reference the partition transformation (e.g., HOUR(order_ts)) explicitly in their queries.<br>Iceberg uses metadata (manifest files) that list data files and their corresponding partition values in this case, the hour since the Unix epoch.</p><p>Iceberg translates the query’s date condition into a range from 2025-01-16 00:00:00 to 2025-01-16 23:59:59.</p><p>It compares the hour partition values in the manifest file and only selects data files that fall within that range. Only matching data files are read. Specifically, the only event that matched is the first event we inserted, since it happened on January 16, 2025 at 05:51:28.</p><p>Apache Iceberg transforms the management of big data tables by abstracting the complex details of data partitioning. Users do not need to write special queries to achieve fast results. When a table is created, the partitioning strategy is defined upfront, and Iceberg handles the rest automatically.</p><p>Under the hood, Iceberg maintains metadata that tracks data files and partitions, enabling efficient data retrieval without scanning the entire dataset. This leads to faster query performance and simplifies maintenance of the data platform.</p><p>In summary, Iceberg enables data teams to work more effectively by combining the scalability of big data with the simplicity and reliability of traditional SQL tables.</p><p>For more information, visit the <a href="https://iceberg.apache.org/">Apache Iceberg official site</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=682cc4ab6776" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>