<?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 Ahamed Arshad on Medium]]></title>
        <description><![CDATA[Stories by Ahamed Arshad on Medium]]></description>
        <link>https://medium.com/@anzanfas?source=rss-6aa22c4224b0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*R4rNIy7NY-blEi1A3yK67A.jpeg</url>
            <title>Stories by Ahamed Arshad on Medium</title>
            <link>https://medium.com/@anzanfas?source=rss-6aa22c4224b0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 16:15:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anzanfas/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 Series (Part 3): Iceberg vs. Hudi vs. Delta Lake]]></title>
            <link>https://medium.com/@anzanfas/apache-iceberg-series-part-3-iceberg-vs-hudi-vs-delta-lake-86eb01595814?source=rss-6aa22c4224b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/86eb01595814</guid>
            <dc:creator><![CDATA[Ahamed Arshad]]></dc:creator>
            <pubDate>Tue, 08 Apr 2025 20:56:45 GMT</pubDate>
            <atom:updated>2025-04-08T20:56:45.662Z</atom:updated>
            <content:encoded><![CDATA[<p>In the first two parts of this series, I dug into why traditional Hive metastores don’t cut it anymore and then took a deep dive under the hood of Apache Iceberg. Now it’s time for the main event — comparing the three heavyweight contenders in the modern table format arena.</p><p>Each of these formats emerged from tech giants facing similar but slightly different problems. Let’s see how they stack up and which might be the best fit for your specific needs.</p><h3>The Origin Stories</h3><p>Each of these formats has a distinct beginning that shaped its evolution:</p><p><strong>Apache Iceberg</strong> was born at Netflix when they hit the limits of what Hive could do with their massive data lake. Netflix engineers needed a format that could handle their scale while maintaining performance. The catalog-driven approach with immutable metadata files became Iceberg’s signature, enabling time travel and efficient queries through its manifest-based structure.</p><p><strong>Apache Hudi</strong> (Hadoop Upserts Deletes and Incrementals) came from Uber’s need to analyze real-time data under heavy load. When you’re ingesting trip data continuously while running analytics on it, you need something special. Hudi’s architecture emphasizes quick updates and deletes, breaking its structure into smaller pieces to support concurrent transactions that don’t block each other.</p><p><strong>Delta Lake</strong> emerged from Databricks, the company built around Apache Spark. Unsurprisingly, they created a format optimized for Spark workloads. Delta Lake takes a different approach to handling changes — using JSON log files with periodic checkpoint parquet files to summarize state.</p><h3>Architecture Face-Off</h3><p>Let’s compare how these formats handle metadata and tracking changes:</p><h3>Metadata Management</h3><p><strong>Iceberg</strong> uses a layered metadata approach:</p><ul><li>The catalog points to the latest metadata file</li><li>Metadata files track snapshots and schema</li><li>Manifest lists point to manifest files</li><li>Manifest files track data files with statistics</li></ul><p>This approach gives Iceberg exceptional query planning abilities. When you run a query, Iceberg doesn’t need to scan the file system or read Parquet footers — it gets everything it needs from the metadata layer.</p><p><strong>Hudi</strong> uses a “.hoodie” directory containing:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vAdtoWEB9A2ImF5g5m5uLw.png" /></figure><ul><li>Transaction logs (tracking timestamp.requested, timestamp.in-flight, timestamp.commit)</li><li>Hoodie.properties (table configuration)</li><li>Metadata tables (similar to Iceberg’s manifests)</li><li>Bloom filters (quickly determine if values might exist)</li><li>Additional indexes for query optimization</li></ul><p>Hudi’s approach is tailored for quickly finding specific records, which makes sense given Uber’s need to locate and update trip records efficiently.</p><p><strong>Delta Lake</strong> uses a simpler approach:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AXo6qKwsoCZJFhlXbO8FLg.png" /></figure><ul><li>A “.delta” folder containing JSON log files</li><li>Each operation creates a new log file</li><li>Periodic “checkpoint.parquet” files summarize the logs (default every 10 changes)</li></ul><p>Delta’s approach might seem simplest, but the checkpointing system is clever — it prevents the logs from growing infinitely while maintaining historical information.</p><h3>Feature Comparison</h3><p>Let’s break down how they handle key features data engineers care about:</p><h3>ACID Transactions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6nVl90ak3fHb3pgvSfxAWw.png" /></figure><p>All three formats support ACID transactions, but their implementations reflect their architectural differences:</p><ul><li><strong>Iceberg</strong>: Implements atomicity through its metadata layer. When you commit changes, Iceberg writes a completely new metadata file that atomically points to the new table state. Conflicts are detected when two processes try to create a new metadata version from the same base version, triggering a retry with the newer base. This approach ensures readers always see a consistent snapshot without locks.</li><li><strong>Hudi</strong>: Manages transactions through a timeline with three distinct states: requested (transaction started), in-flight (data being written), and committed (changes finalized). The transaction log tracks state transitions, ensuring atomicity by controlling the visibility of data files. Hudi’s approach is particularly optimized for concurrent writers updating different record sets.</li><li><strong>Delta Lake</strong>: Uses a write-ahead log (WAL) where each transaction appends JSON entries sequentially. For atomicity, a writer first stages changes, then atomically adds a commit entry with file additions/removals. Readers check for a complete commit record before using new files. Delta’s checkpointing mechanism periodically consolidates logs into Parquet, improving read performance without losing historical information.</li></ul><h3>Table Evolution</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OYLooWbXUNJPEZ0m2CU3dg.png" /></figure><p>This is where Iceberg pulls ahead:</p><ul><li><strong>Schema Evolution</strong>: All three support adding, renaming, and reordering columns</li><li><strong>Partition Evolution</strong>: Only Iceberg supports changing partition schemes without data movement</li></ul><p>Partition evolution is a genuine Iceberg superpower. If you initially partitioned by day but later decided month would be more efficient, only Iceberg lets you make that change without physically reorganizing data.</p><h3>Row-Level Updates</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*twisOLEyl1HIxqddshEl4w.png" /></figure><p>All three support row-level operations, but their approaches differ:</p><ul><li><strong>Iceberg</strong>: Supports position deletes and equality deletes</li><li><strong>Hudi</strong>: Uses log files alongside data files</li><li><strong>Delta Lake</strong>: Uses deletion vectors</li></ul><p>Hudi’s original focus on upserts makes it particularly strong for update-heavy workloads.</p><h3>Z-Order Clustering</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WUETMG8Fg_MRkxwwpLUPkQ.png" /></figure><p>Z-order clustering allows organizing data based on multiple columns simultaneously:</p><ul><li><strong>Example</strong>: Clustering by both AGE and HEIGHT as shown in the image</li><li>All three formats support this, enabling better data locality for multi-column filters</li></ul><h3>Versioning</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xE-uv0JSUGZREL8x9BBYnQ.png" /></figure><p>Iceberg has the most comprehensive versioning support across different levels:</p><ul><li><strong>Catalog Versioning</strong>: Only Iceberg supports this level of versioning, which tracks changes to the catalog itself. This means you can see when tables were created, altered, or dropped over time, and even roll back catalog-level operations if needed. Hudi and Delta Lake don’t maintain version history at the catalog level.</li><li><strong>Table Versioning</strong>: Again, only Iceberg offers complete table versioning capabilities. This allows you to track the full history of a table’s evolution — including schema changes, partition spec modifications, and sort order changes — and access any historical version of the table structure. While Hudi and Delta track file changes, they don’t maintain this comprehensive table-level versioning.</li><li><strong>File Versioning</strong>: All three formats support this basic level of versioning, tracking which data files belong to which versions of the table. This enables time travel queries to see data as it existed at a previous point in time.</li></ul><p>Iceberg’s multi-level versioning provides significant advantages for governance, compliance, and debugging. For example, if someone accidentally changes a table’s schema, you can easily roll back to a previous version without data loss — something that’s much harder or impossible with the other formats.</p><h3>Partitioning</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xabyVZkaigh3Ei9xKaxY4g.png" /></figure><p>Iceberg offers the most sophisticated partitioning capabilities:</p><ul><li><strong>Auto Transformation</strong>: Both Iceberg and Delta Lake can automatically transform data values into partitions (like extracting year/month from timestamps) without manual conversion in ETL. Hudi requires explicitly managing these transformations in your data pipeline code.</li><li><strong>Metadata-Only Values</strong>: Only Iceberg stores partition information purely as metadata without encoding it in physical file paths. This approach eliminates path-based limitations and enables more flexible partition schemes, while Hudi and Delta Lake still rely on directory structures.</li><li><strong>No Extra Query Filters Needed</strong>: With Iceberg and Delta Lake, you can query using the original column (e.g., WHERE timestamp &gt; &#39;2023-01-01&#39;) and the system automatically applies partition pruning. Hudi requires explicitly filtering on partition columns (e.g., WHERE year = 2023 AND month = 1).</li><li><strong>Partition Evolution</strong>: Only Iceberg lets you change partition schemes without rewriting data. If you initially partitioned by day but now want to use month, Iceberg handles this through metadata changes alone, while both Hudi and Delta Lake would require physically reorganizing files.</li></ul><h3>When to Choose Each Format</h3><p>Based on these comparisons, here’s when I’d recommend each format:</p><p><strong>Choose Apache Iceberg when:</strong></p><ul><li>You need partition evolution (crucial for long-lived tables)</li><li>Comprehensive versioning at catalog and table levels matters</li><li>Complex schema evolution is expected</li><li>You value query performance through extensive metadata</li><li>You have a multi-language environment (REST Catalog)</li></ul><p><strong>Choose Apache Hudi when:</strong></p><ul><li>Real-time ingestion is your primary concern</li><li>Your workload is heavy on upserts and deletes</li><li>You need incremental processing for streaming</li><li>Bloom filters would accelerate your point lookups</li><li>Record-level indexing would benefit your use cases</li></ul><p><strong>Choose Delta Lake when:</strong></p><ul><li>You’re deeply invested in the Spark ecosystem</li><li>You prefer simplicity in the metadata structure</li><li>Your workloads are mainly Spark SQL queries</li><li>You value the Databricks integration</li></ul><h3>Interoperability</h3><p>One exciting development is the growing interoperability between formats:</p><ul><li><strong>Query Federation</strong>: Engines like Dremio can query across multiple formats</li><li><strong>Apache XTable</strong>: Converts metadata between formats</li><li><strong>Delta Lake Uniform</strong>: Writes to Delta while syncing Iceberg/Hudi metadata</li></ul><p>These developments suggest we might be moving toward a future where the underlying format matters less, and you can mix and match based on workload needs.</p><h3>The Final Verdict</h3><p>There’s no one-size-fits-all answer here. Each format has strengths aligned with its origin:</p><ul><li><strong>Iceberg</strong> excels at analytical queries and schema/partition flexibility</li><li><strong>Hudi</strong> shines for real-time ingestion and point lookups</li><li><strong>Delta Lake</strong> offers simplicity and tight Spark integration</li></ul><p>For my money, Iceberg has the most comprehensive feature set and the cleanest architecture, but your mileage may vary depending on your specific needs.</p><p>The good news is that with growing interoperability, you don’t necessarily have to choose just one. You could use Hudi for real-time ingestion tables, Iceberg for your core analytical datasets, and Delta Lake for Spark-heavy processing jobs.</p><p>That wraps up our three-part journey through the evolution of data lake table formats. From the limitations of Hive to the sophisticated architecture of Iceberg and now this comparison of modern solutions, I hope you’re better equipped to make informed decisions about your data lakehouse architecture.</p><p>thank-you ❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86eb01595814" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apache Iceberg Series (Part 2): Under the Hood]]></title>
            <link>https://medium.com/@anzanfas/apache-iceberg-series-part-2-under-the-hood-ce2eb14e838c?source=rss-6aa22c4224b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce2eb14e838c</guid>
            <dc:creator><![CDATA[Ahamed Arshad]]></dc:creator>
            <pubDate>Sun, 06 Apr 2025 21:22:25 GMT</pubDate>
            <atom:updated>2025-04-10T21:15:56.832Z</atom:updated>
            <content:encoded><![CDATA[<p>In <a href="https://medium.com/@anzanfas/apache-iceberg-series-the-evolution-beyond-hive-metastores-50019e91eeb1">Part-1</a> of this series, I walked through why traditional Hive metastores and directory-based table formats just can’t keep up with what we need in modern data lakes. Those pesky problems like physical and logical partitioning being tied together, painfully slow query planning, and that nightmare of trying to evolve schemas — they’re all holding us back.</p><p>Now I’m going to rip open the hood on Apache Iceberg and show you how it tackles these headaches. Born at Netflix when they were struggling with Hive’s limitations, Iceberg has grown into something that gives us the best of both worlds — database-like features without sacrificing the flexibility we love about data lakes.</p><h3>Core Architecture of Apache Iceberg</h3><p>So what makes Iceberg tick? It’s all about the layers. Think of it like a well-built car — each system doing its own job but working together perfectly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-U6xInmOVl3gCV3LmddP3Q.png" /></figure><h3>The Three-Layer Architecture</h3><ol><li><strong>Catalog Layer</strong> — Your traffic controller, keeping track of where tables are and pointing to the most recent metadata</li><li><strong>Metadata Layer</strong> — The brains of the operation, managing snapshots, schemas, and keeping lists of all your files</li><li><strong>Data Layer</strong> — Where your actual data lives, typically in Parquet files</li></ol><p>This separation isn’t just fancy architecture for architecture’s sake. It’s what lets Iceberg pull off its magic tricks without slowing things down. Let’s dig into each piece.</p><h3>The Catalog Layer</h3><p>The catalog is like the front desk at a hotel — it’s where every interaction starts. Need to access a table? Your query engine first checks in with the catalog to find out where the latest metadata is hanging out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o87tk9FKNEg6VDq6C9GsJw.png" /></figure><p>The catalog has two main jobs, and they’re pretty straightforward:</p><ol><li><strong>Keeping track of where the current metadata lives</strong> for each table</li><li><strong>Making sure updates happen atomically</strong> so nothing breaks</li></ol><p>You’ve got options for how to implement catalogs, including these common ones:</p><ul><li><strong>Hive Metastore</strong> — Old reliable, using Hive as your catalog service</li><li><strong>AWS Glue</strong> — Plays nice with AWS if that’s your thing</li><li><strong>JDBC Catalogs</strong> — Store pointers in your trusty relational DB</li><li><strong>REST Catalog</strong> — Language-agnostic HTTP API for table operations</li></ul><h3>The REST Catalog: Breaking Down Language Barriers</h3><p>The REST Catalog is a particularly powerful innovation in Iceberg’s architecture. Unlike traditional catalog implementations that require specific language SDKs, the REST Catalog provides a standardized HTTP interface that any language can interact with.</p><p>Here’s how it works technically:</p><ol><li><strong>RESTful API Interface</strong>: The REST Catalog exposes standard HTTP endpoints for all catalog operations: <br>* GET requests for retrieving table metadata<br>* POST requests for creating or updating tables<br>* DELETE requests for removing tables<br>* HEAD requests for checking if tables exist</li><li><strong>Standardized JSON Responses</strong>: All responses follow a consistent JSON schema, making them easily parsable in any language that supports HTTP and JSON.</li><li><strong>Authentication &amp; Authorization</strong>: The REST Catalog supports various authentication mechanisms including OAuth2, making it secure in enterprise environments.</li><li><strong>Atomicity Guarantees</strong>: Even through HTTP, the REST Catalog maintains atomic operations for metadata updates by using optimistic concurrency control with version checking.</li><li><strong>Namespace Support</strong>: Tables can be organized into namespaces (similar to database schemas), allowing for logical organization of tables.</li></ol><h4>REST Catalog in Action</h4><p>Here’s a simple example of how you might use the REST Catalog in Python:</p><pre>import requests<br># Get all tables in the &#39;analytics&#39; namespace<br>response = requests.get(<br>    &quot;https://iceberg-catalog.company.com/v1/namespaces/analytics/tables&quot;,<br>    headers={&quot;Authorization&quot;: &quot;Bearer eyJhbGciOiJS...&quot;}<br>)<br>tables = response.json()</pre><p>The key advantage here is consistency across languages. Whether you’re:</p><ul><li>Creating tables (sending POST requests with schema definitions)</li><li>Reading metadata (GET requests to retrieve file locations)</li><li>Managing snapshots (tracking table history via the API)</li></ul><p>Every language uses the same REST endpoints and receives identical JSON responses. This means your Python data scientists, Java backend engineers, and Rust performance team all work with the same source of truth, eliminating the “it works differently in my language” problem that plagues many data platforms.</p><p>The practical implementation can be as simple as a containerized REST service that teams across the organization can access, with the actual metadata storage happening in a robust</p><h3>The Metadata Layer: How Iceberg Tracks Everything</h3><p>If the catalog is the front desk, the metadata layer is where the real magic happens. This is where Iceberg blows traditional approaches out of the water, using a clever hierarchy of JSON files to keep tabs on everything.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2E7dosWBEJQH8QS4oZyAEA.png" /></figure><h3>Metadata Files</h3><p>Every Iceberg table has a chain of metadata files (v1.metadata.json, v2.metadata.json, and so on). Think of each one as a complete snapshot of your table’s status, packed with:</p><ul><li>A unique ID and location for your table</li><li>The current schema (what columns you have)</li><li>How your data is partitioned</li><li>Which snapshot is the current one</li><li>A log of all the changes that got you here</li></ul><p>The brilliant part? Every time you change your table, Iceberg creates a new metadata file instead of updating the old one. This means nothing ever gets lost — a lifesaver when you need to roll back changes or see what happened six months ago.</p><h3>Snapshots</h3><p>Snapshots are exactly what they sound like — a picture of your table at a specific moment. Each one contains:</p><ul><li>A pointer to a manifest list (more on that in a second)</li><li>Who its parent was (the previous snapshot)</li><li>When it was created</li><li>A summary of what changed</li></ul><h3>Manifest Lists and Manifest Files</h3><p>This is where Iceberg’s metadata architecture really shines. Let’s break down these critical components in detail:</p><h4>Manifest Lists</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4V5Zpt8GvO-Sra4sMIVg1g.png" /></figure><p>A manifest list is essentially a catalog of all manifest files associated with a specific table-snapshot. Each manifest list contains:</p><ul><li><strong>Manifest file paths</strong>: Locations of all manifest files for this snapshot</li><li><strong>Partition spec ID</strong>: Which partition specification was used</li><li><strong>Added snapshot ID</strong>: When this manifest was added to the table</li><li><strong>Added files count</strong>: Number of data files added in this manifest</li><li><strong>Existing files count</strong>: Number of files carried over from previous snapshots</li><li><strong>Deleted files count</strong>: Number of files marked for deletion</li><li><strong>Partition summary data</strong>: Metadata about the partitions covered</li></ul><p>When a query engine needs to access data, it first reads the manifest list to identify which manifest files might contain relevant data. This allows for efficient partition-level pruning before even looking at individual files.</p><h4>Manifest Files</h4><p>Each manifest file is a detailed inventory of data files belonging to one particular manifest, along with rich metadata about each file:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QnqaSwmUOEUBpW3RZk5T4w.png" /></figure><ul><li><strong>File path</strong>: Location of the data file in storage</li><li><strong>File format</strong>: Usually Parquet, but could be Avro or ORC</li><li><strong>Partition data</strong>: Which partition this file belongs to</li><li><strong>Record count</strong>: Number of records in the file</li><li><strong>File size</strong>: Size in bytes</li><li><strong>Column-level statistics</strong>: Critical min/max values for each column</li><li><strong>Null value counts</strong>: How many nulls exist for each column</li><li><strong>Value counts</strong>: Distribution information for columns</li><li><strong>Lower and upper bounds</strong>: Range of values in each column</li></ul><p>Here’s what makes this so powerful: when you query for records where, say, timestamp is between &#39;2024-06-15&#39; and &#39;2024-06-30&#39;, Iceberg doesn&#39;t blindly scan all files. Instead:</p><ul><li>It scans the manifest list to identify relevant manifests based on partition data</li><li>It reads only those manifests to find files with potential matches</li><li>It examines the min/max values for the timestamp column in each file</li><li>It skips any files where min_timestamp &gt; ‘2024–06–30’ or max_timestamp &lt; ‘2024–06–15’</li></ul><p>This multi-level filtering approach means Iceberg often avoids reading 90% or more of your data files during queries, dramatically improving performance compared to Hive’s directory-scanning approach.</p><p>As your notes show, after looping through the manifest file statistics, Iceberg can determine whether a particular column (like a timestamp) has data in the relevant range, allowing it to skip entire files without ever reading their contents.</p><h3>How Table Operations Work in Iceberg</h3><p>Let’s look at how common operations work in Iceberg:</p><h3>Creating a Table</h3><p>When you create a new Iceberg table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x6de5Vuuf1RJUEliiUFX5Q.png" /></figure><ol><li>A metadata directory is created with an initial v1.metadata.json file</li><li>This file defines the schema and partition spec but doesn’t reference any data files</li><li>The catalog is updated to point to this metadata file</li></ol><h3>Adding Data</h3><p>When you insert data:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BlA_DzKE3saUOdYa1qRE9Q.png" /></figure><ol><li>Data files are written to the storage layer</li><li>A manifest file is created listing these new files with their statistics</li><li>A manifest list is created referencing this manifest</li><li>A new metadata file (v2.metadata.json) is created referencing the manifest list</li><li>The catalog is atomically updated to point to the new metadata file</li></ol><blockquote>This bottom-up approach ensures data is safely written before becoming visible.</blockquote><h3>Reading Data</h3><p>When querying an Iceberg table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qAc48Twhv4sEhnP85Mx_LQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zi-v2oBPmVlmEBc5pz1GlA.png" /></figure><ol><li>The query engine consults the catalog to find the latest metadata file</li><li>It reads the metadata file to get the manifest list location</li><li>It scans the manifest list to find relevant manifests</li><li>It uses manifests to identify which data files to read</li><li>Only the required files are read for the query</li></ol><h3>Updating Data</h3><p>Iceberg supports two strategies for data modifications:</p><p><strong>Copy-on-Write (COW)</strong>:</p><ul><li>Rewrites entire data files when records need updating</li><li>Simpler but more I/O intensive for frequent updates</li><li>Better read performance since files are optimized</li></ul><p><strong>Merge-on-Read (MOR)</strong>:</p><ul><li>Handles both updates and deletes without rewriting existing data files</li><li>For deletions: Creates separate “delete files” that track which records to skip</li><li>For additions: Writes new records to separate “data files” that get appended to the table</li><li>For updates: Combines both approaches — marks old record versions in delete files and adds new versions in data files</li><li>When a query runs, it merges all these files on-the-fly — applying deletes and additions at read time</li><li>Much more efficient for writing frequent changes since you avoid rewriting large existing files</li><li>Essentially defers the merge operation to query time rather than doing it at write time</li><li>Trades slightly higher read complexity for significantly faster write operations</li></ul><blockquote>Both approaches maintain atomicity and isolation through the metadata layer.</blockquote><h3>Handling Deletes</h3><p>One of Iceberg’s powerful features is how it handles record deletions. Rather than immediately modifying your original data files (which would be expensive), Iceberg tracks deletions separately through specialized “delete files.” There are two distinct approaches:</p><h4>1. Position Deletes</h4><p>Position deletes work like a set of precise coordinates pointing to exactly which rows should be skipped:</p><ul><li><strong>How they work</strong>: Each position delete contains a file path and a row position (like “skip row 42 in file_001.parquet”)</li><li><strong>Under the hood</strong>: They store the exact physical location of rows to be ignored</li><li><strong>Example use case</strong>: When you know exactly which rows you want to delete (like during a transaction where you’ve identified specific records)</li></ul><p><strong>Advantages</strong>:</p><ul><li>Much faster at query time because the engine knows exactly which rows to skip</li><li>No need to evaluate conditions for each record</li><li>Precise targeting means less processing during reads</li></ul><p><strong>Drawbacks</strong>:</p><ul><li>Creating position deletes requires knowing the exact position of each row</li><li>This often means reading the files first, making write operations slower</li><li>More metadata to manage since each position must be tracked exactly</li></ul><h4>2. Equality Deletes</h4><p>Equality deletes work more like filter conditions, saying “ignore any records where these values match”:</p><ul><li><strong>How they work</strong>: Each equality delete contains column values that identify records to skip</li><li><strong>Under the hood</strong>: They store predicates like “delete where user_id = 1001 and timestamp = ‘2023–02–15’”</li><li><strong>Example use case</strong>: When deleting based on business conditions (like “delete all orders from this customer”)</li></ul><p><strong>Advantages</strong>:</p><ul><li>Faster to write because you don’t need to find physical positions first</li><li>More flexible for business logic-based deletions</li><li>Can target records across multiple files with a single delete specification</li></ul><p><strong>Drawbacks</strong>:</p><ul><li>Slower at read time because each record must be checked against delete conditions</li><li>More CPU-intensive during queries</li><li>Can impact performance on large tables with many delete conditions</li></ul><p>This two-option approach gives you flexibility based on your workload. If your application does frequent deletes but not as many reads, equality deletes might be better. If you prioritize query performance, position deletes will generally yield faster results.</p><p>When query engines read Iceberg tables, they automatically apply these deletion rules behind the scenes, so your queries always see the correct current state of the data.</p><h3>Advanced Features That Set Iceberg Apart</h3><h3>Hidden Partitioning</h3><p>Traditional Hive-style partitioning physically organizes data using directory structures, leading to significant limitations:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V7CEeU32KEXKguhXrikX9w.png" /></figure><p>This approach creates problems when partitioning by high-cardinality fields like dates:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qEEdUbJJ97MKUWqumecPXA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-NFWhm4xfr_Xadp2jHTgrw.png" /></figure><p>The directory-based approach means one directory per partition value, leading to:</p><ul><li>Too many small files</li><li>Slow query planning (from listing directories)</li><li>Physical reorganization when changing partition schemes</li></ul><blockquote><strong>Iceberg solves this with hidden partitioning</strong></blockquote><h4><strong>What makes hidden partitioning different:</strong></h4><ul><li>Partitioning is defined and tracked completely in metadata, not in storage paths</li><li>Physical files aren’t organized by partition values in the directory structure</li><li>Iceberg can filter by partition values efficiently using metadata without directory listing</li><li><strong>Partition values are computed on-the-fly from your data columns using transformation functions</strong>. For example, instead of storing the full timestamp, Iceberg might extract just the month value and use that for partitioning.This approach enables powerful capabilities:</li></ul><h4>Understanding Partition Transforms</h4><p>Iceberg supports various transforms that make partitioning much more flexible:</p><p><strong>1. Time-based transforms:</strong></p><ul><li><strong>Year</strong>: Extracts just the year from a timestamp column<br>- Example: 2024-06-15 → 2024 as partition value<br>- Perfect for historical analysis across years</li><li><strong>Month</strong>: Extracts year and month<br>- Example: 2024-06-15 → 2024-06 as partition value<br>- Balances granularity with partition count for monthly reporting</li><li><strong>Day</strong>: Extracts year, month, and day<br>- Example: 2024-06-15 → 2024-06-15 as partition value<br>- Good for daily analysis while keeping partition count reasonable</li><li><strong>Hour</strong>: Extracts year, month, day, and hour<br>- Example: 2024-06-15 09:32:01 → 2024-06-15-09 as partition value<br>- Useful for time-series data with hourly patterns</li></ul><p><strong>2. Distribution transforms:</strong></p><ul><li><strong>Bucket</strong>: Applies a hash function to distribute data evenly<br>- Example: customer_id: 42953 → hash(42953) % 16 = 5 as partition value<br>- Great for high-cardinality fields like IDs, creating a fixed number of partitions<br>- You specify the bucket count: bucket(16, customer_id)</li></ul><p><strong>3. Truncation transform:</strong></p><ul><li><strong>Truncate</strong>: Keeps a specified number of characters<br>- Example: truncate(2, zip_code) on 90210 → 90 as partition value<br>- Perfect for prefix-based grouping like zip codes, IP addresses</li></ul><p>What makes this powerful is that you can change your partitioning scheme without physically reorganizing data. For example, if you initially partitioned by day but later want to switch to month, Iceberg simply updates the metadata — no data movement required.</p><p>When querying, Iceberg automatically handles partition pruning behind the scenes:</p><pre>-- This query will only read files from June 2024<br>SELECT * <br>FROM your_table_name<br>WHERE date BETWEEN &#39;2024-06-01&#39; AND &#39;2024-06-30&#39;;</pre><p>The query engine uses partition metadata to identify exactly which files contain relevant data, skipping everything else without requiring you to specify partition columns explicitly.</p><h3>Table Optimization</h3><p>Iceberg provides built-in tools for maintaining optimal performance:</p><p><strong>Compaction</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kde-edNkIt-Bx5E3PJkFQQ.png" /></figure><blockquote>Files are immutable in Iceberg. Operations that modify data create new files. Compaction combines small files into larger ones to improve query performance.</blockquote><p>You can run compaction in Spark with different strategies:</p><pre># For more control, you can use the DataFrameWriter API<br>from py4j.java_gateway import java_import<br>from pyspark.sql.utils import to_str<br><br># Get the Iceberg catalog<br>java_import(spark._jvm, &quot;org.apache.iceberg.spark.actions.SparkActions&quot;)<br>actions = spark._jvm.org.apache.iceberg.spark.actions.SparkActions.get()<br><br># Set up compaction with sorting for better read performance<br>table = actions.table(&quot;nessie.hr.employees&quot;)<br>table.rewriteDataFiles() \<br>    .option(&quot;min-input-files&quot;, &quot;5&quot;) \<br>    .option(&quot;max-concurrent-file-group-rewrites&quot;, &quot;10&quot;) \<br>    .option(&quot;partial-progress.enabled&quot;, &quot;true&quot;) \<br>    .option(&quot;strategy&quot;, &quot;sort&quot;) \<br>    .option(&quot;sort-order&quot;, &quot;id ASC NULLS LAST, name ASC NULLS FIRST&quot;) \<br>    .execute()</pre><p>This Python approach gives you fine-grained control over compaction parameters and can be integrated into your data pipeline workflows.</p><p><strong>Snapshot Expiration</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p1-jzuyvukTx-mGaBZrLGA.png" /></figure><p>As snapshots accumulate, they consume storage and slow metadata operations. Iceberg lets you expire old snapshots with Python:</p><pre>from pyspark.sql import SparkSession<br>from datetime import datetime<br><br>spark = SparkSession.builder.appName(&quot;Iceberg Snapshot Expiration&quot;).getOrCreate()<br># Access Iceberg API classes<br>from py4j.java_gateway import java_import<br>java_import(spark._jvm, &quot;org.apache.iceberg.spark.actions.SparkActions&quot;)<br># Expire snapshots older than a specific date<br>actions = spark._jvm.org.apache.iceberg.spark.actions.SparkActions.get()<br>table = actions.table(&quot;nessie.hr.employees&quot;)<br>expireAction = table.expireSnapshots()<br>expireAction.expireOlderThan(datetime(2023, 1, 1).timestamp() * 1000)<br>expireAction.execute()</pre><h3>How Snapshot Expiration Actually Works</h3><p>Here’s what happens behind the scenes during snapshot expiration:</p><ol><li>Iceberg identifies all snapshots marked for expiration (based on age or specific IDs)</li><li>For each data file referenced in these expired snapshots, Iceberg checks if the file is also referenced by any <strong>valid</strong>(non-expired) snapshots</li><li><strong>Only files that are unique to expired snapshots get physically deleted</strong></li><li>Files that are shared with any valid snapshot are preserved, even if their original snapshot is expired</li><li>All metadata for expired snapshots is removed regardless</li></ol><blockquote>This intelligent cleanup means you can safely expire old snapshots without worrying about corrupting your current data, while still reclaiming storage from truly obsolete files.</blockquote><h3>The Power of Metadata Tables</h3><p>Iceberg provides special tables for inspecting and analyzing table state:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uGjei673r7H5sGZVKZEZog.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YhL4WqDqgMwH5LR8RUwupw.png" /></figure><p>These tables enable powerful use cases:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3oHwU7igOrPi3xR7fiHL2A.png" /></figure><h3>Putting It All Together: The Iceberg Query Process</h3><p>Iceberg’s design enables highly efficient queries through multiple layers of optimization:</p><ol><li><strong>Catalog lookup</strong> — Find the latest metadata file</li><li><strong>Metadata file processing</strong> — Get schema, partitioning info, manifest list location</li><li><strong>Manifest list filtering</strong> — Identify relevant manifests based on partition stats</li><li><strong>Manifest pruning</strong> — Use file statistics to skip irrelevant files</li><li><strong>Data reading</strong> — Read only the necessary data files</li></ol><p>This process eliminates time-consuming directory listings and enables precise pruning of data files before they’re accessed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mtxGQutX4WNdrrantOucyQ.png" /></figure><blockquote>Unlike Hive, where even a simple date-filtered query might require scanning all partitions, Iceberg uses its metadata to skip irrelevant files automatically.</blockquote><h3>Conclusion</h3><p>Apache Iceberg represents a significant evolution in data lake table formats. By addressing the core limitations of Hive metastores through its sophisticated metadata architecture, Iceberg delivers:</p><ul><li>Better query performance through detailed metadata tracking</li><li>Seamless schema and partition evolution</li><li>ACID guarantees for multi-table transactions</li><li>Time travel capabilities for auditing and recovery</li><li>Improved maintenance options for optimal performance</li><li>Language-agnostic access through the REST Catalog</li></ul><p>In the next part of this series, we’ll compare Iceberg with other modern table formats like Apache Hudi and Delta Lake, helping you choose the right solution for your specific needs.</p><p>Stay tuned for Part 3: <a href="https://medium.com/@anzanfas/apache-iceberg-series-part-2-under-the-hood-ce2eb14e838c"><strong>Iceberg vs. Hudi vs. Delta Lake: Choosing Your Lakehouse Foundation</strong></a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce2eb14e838c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apache Iceberg Series (Part 1): The Evolution Beyond Hive Metastores]]></title>
            <link>https://medium.com/@anzanfas/apache-iceberg-series-the-evolution-beyond-hive-metastores-50019e91eeb1?source=rss-6aa22c4224b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/50019e91eeb1</guid>
            <dc:creator><![CDATA[Ahamed Arshad]]></dc:creator>
            <pubDate>Fri, 28 Mar 2025 21:22:19 GMT</pubDate>
            <atom:updated>2025-04-09T20:24:45.856Z</atom:updated>
            <content:encoded><![CDATA[<p>The data landscape has evolved dramatically over the past decade, but many organizations still rely on aging technologies designed for a different era. If you’re still using Hive metastores for your data lake management in 2024, you’re likely facing serious limitations that are holding back your data operations. In this first part of my series on Apache Iceberg, I’ll break down why traditional approaches are no longer cutting it and set the stage for modern solutions.</p><h3>The Evolution of Data Storage</h3><p>To understand where we are today, let’s look at how data systems have evolved:</p><h4>Traditional Data Systems</h4><p>Remember the good old days when all we had to worry about were databases and data warehouses? These systems used rigid table formats with well-defined schemas, catalogs, and processing engines. While they excelled at handling structured data, their inflexibility became apparent when dealing with:</p><ul><li>Schema changes that required expensive downtime and migration processes</li><li>Semi-structured data like JSON or nested records that didn’t fit neatly into rows and columns</li><li>High-volume data ingestion that needed to happen without schema validation</li><li>Storage costs that skyrocketed with the explosion of data volumes, as these systems weren’t designed to separate storage from compute</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zcs12bM0d6aTHknLEaQtZg.png" /><figcaption>Traditional Data System</figcaption></figure><h4>Enter the Data Lake</h4><p>As data volumes exploded, the concept of data lakes emerged. At its core, a data lake is simply a storage repository that can hold vast amounts of raw data in its native format until needed. But what exactly makes a data lake different?</p><p>A data lake typically uses Hadoop/object storage and can store various file formats including:</p><ul><li>Parquet files (the workhorse of data lakes)</li><li>Images</li><li>Videos</li><li>Plain text files</li></ul><p>The beauty of a data lake is its ability to handle both structured and unstructured data while maintaining raw fidelity. This was revolutionary compared to traditional systems that forced data into predefined structures.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0q0--Yv-9urAy1JxeowO7w.png" /><figcaption>hudoop-object storage</figcaption></figure><h4>The Technical Foundation: Parquet Files</h4><p>If you’ve worked with data lakes, you know Parquet is the main player. But why?</p><p>Parquet changed the game by offering:</p><ul><li>Binary file format with efficient encoding (unlike CSV’s text-based format, Parquet’s binary encoding uses fewer bytes to represent the same values, often reducing file sizes by 75% or more)</li><li>Columnar structure for better compression and query performance (similar values stored together compress better, and queries can skip columns they don’t need)</li><li>Row groups with metadata footers for smart data access (containing statistics like min/max values for efficient filtering)</li><li>Dictionary encoding for repeated values (common in real-world data, saving significant space)</li><li>Specialized encoding schemes based on data patterns: <em>• RLE (Run Length Encoding) for repeated sequences • Bit-packing for integers within a small range • Delta encoding for sequences with small differences between values • Plain encoding for high-cardinality or random data where other encodings don’t provide benefits</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*diSncKAW8Gvti4N-qP4yVA.png" /></figure><p>Parquet organizes data into a hierarchical structure that optimizes for both storage and query performance. The file consists of row groups, each containing chunks of column data rather than complete rows. Each column chunk includes a dictionary page (storing unique values) and data pages (storing references to the dictionary).</p><p>What makes this structure so powerful is the file footer, which stores crucial metadata including column statistics (min/max values, null counts) for each row group. This enables “predicate push-down,” a technique that dramatically improves query performance.</p><p>To understand predicate push-down, imagine you’re querying for users aged 25–30 from a dataset with millions of records spread across multiple row groups. Instead of scanning all data, Parquet first checks the statistics in the footer and determines:</p><ul><li>Row Group 1: Contains ages 20–45 (must be scanned)</li><li>Row Group 2: Contains ages 46–60 (can be skipped entirely)</li><li>Row Group 3: Contains ages 18–24 (can be skipped entirely)</li></ul><p>By examining only the metadata, Parquet can immediately eliminate irrelevant row groups before loading any actual data into memory. In real-world scenarios, this might mean skipping 90% of your data, dramatically reducing I/O, memory usage, and processing time — especially important when dealing with terabytes of data.</p><p>Additionally, since Parquet uses a columnar format, it can be efficiently converted to Apache Arrow for in-memory processing, making analysis even faster.</p><h3>The Multi-File Dataset Problem</h3><p>Here’s where things get tricky. In real-world scenarios, we typically have multiple Parquet files related to a single dataset (eg: like user’s data). How do we handle this collection as a cohesive unit?</p><p>It’s not practical to manually add each Parquet file to our analytics pipeline. We need some sort of “glue” to handle these files as a group. This is where Apache Hive entered the picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*42H4AKKhHqnYP7lF6xnDwQ.png" /></figure><h3>The Hive Approach: Well-Intentioned But Flawed</h3><p>Hive was developed within the Hadoop ecosystem, originally using MapReduce (yeah, remember those days?). It provided a SQL-like interface to work with files in a distributed file system.</p><p>The traditional Hive approach uses a metastore that simply tracks file folders and partitions used for tables. Sounds good in theory, but in practice, it created serious operational headaches:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NX-UVbvYfEUOoGipmoNpGQ.png" /></figure><ol><li><strong>File Listing Challenges</strong>: Keeping track of potentially thousands of files</li><li><strong>No Granular Updates</strong>: Need to update one record? Sorry, you’ll have to rewrite the entire partition</li><li><strong>Schema Evolution Pain</strong>: Want to add a column? Prepare to rewrite ALL your data files</li><li><strong>Limited Table Evolution</strong>: Making structural changes becomes a massive operation</li></ol><p>These limitations were acceptable when batch processing dominated and data changes were infrequent. But in today’s world of streaming data and real-time analytics? They’re dealbreakers.</p><h3>The Modern Approach: Metadata-Driven Tables</h3><p>The latest approach solves these problems by separating concerns. Instead of embedding everything in the files themselves, modern solutions use metadata files that track:</p><ul><li>Schema definitions</li><li>Partitioning strategies</li><li>File mappings with smart indexing (like users1.parquet containing ages 20–30)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VtQuch3-KVzpoSl_w7OjuA.png" /></figure><p>This separation delivers game-changing benefits:</p><ul><li><strong>Faster Scans</strong>: The system knows exactly which files contain relevant data</li><li><strong>Time Travel</strong>: Query data as it existed at any point in time</li><li><strong>ACID Transactions</strong>: Reliable, consistent operations even with concurrent users</li><li><strong>Efficient Updates</strong>: Make changes without rewriting entire datasets</li><li><strong>Painless Schema Evolution</strong>: Add columns without touching existing data</li></ul><h3>The Data Lakehouse: Bringing It All Together</h3><p>The challenges with traditional data lakes and the limitations of Hive metastores led to the emergence of a new paradigm: the data lakehouse. This architecture combines the best of both worlds — the flexibility and cost-efficiency of data lakes with the performance and reliability of data warehouses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yEsXJPiQXn3Y0K2lM3nZtQ.png" /></figure><p>A data lakehouse adds critical warehouse-like features on top of your data lake:</p><ul><li><strong>Table Format</strong>: Structured data management with advanced features</li><li><strong>Catalog</strong>: Enhanced metadata management beyond basic file tracking</li><li><strong>Computation Layer</strong>: Optimized processing engines like Spark and Dremio</li></ul><p>The key innovation is that data lakehouses bring structure and performance to data lakes without sacrificing their flexibility and cost advantages. This allows you to:</p><ul><li>Run both BI and ML workloads on the same data</li><li>Enforce data quality and governance</li><li>Support ACID transactions for data reliability</li><li>Deliver performance comparable to traditional warehouses</li></ul><h3>Open Table Formats: The Foundation of Modern Data Lakes</h3><p>At the heart of the data lakehouse revolution is the concept of open table formats. Unlike proprietary data formats that lock you into specific vendors, open table formats provide standard specifications for how data and metadata should be organized, allowing different processing engines to interact with the same data reliably.</p><p>These open formats are defined by key characteristics:</p><ul><li><strong>Engine-agnostic</strong>: Work with various query engines (Spark, Presto, Flink, etc.)</li><li><strong>Language-agnostic</strong>: Support multiple programming languages</li><li><strong>Vendor-neutral</strong>: Not tied to any specific cloud provider or platform</li><li><strong>Community-driven</strong>: Developed through open governance models</li></ul><p>Open table formats solve the fundamental issues with Hive’s approach by providing:</p><ul><li>A single source of truth for table definitions</li><li>Consistent metadata management</li><li>Standardized ways to handle schema evolution</li><li>Built-in transaction support</li><li>Optimizations for modern cloud storage</li></ul><p>This open approach has led to wider adoption and innovation, creating an ecosystem where tools can interoperate seamlessly across different platforms.</p><h3>The Three Pillars of Modern Data Lakehouses</h3><p>If you’re still using classic Hive metastores in 2024, you’re missing out on these benefits. The data lakehouse paradigm has emerged with solutions that deliver both the flexibility of data lakes and the performance of warehouses.</p><p>The three key players leading this revolution are:</p><ul><li><a href="https://hudi.apache.org/"><strong>Apache Hudi</strong>:</a> Focuses on incremental processing and upserts</li><li><a href="https://iceberg.apache.org/"><strong>Apache Iceberg</strong></a>: Emphasizes table evolution and schema flexibility</li><li><a href="https://delta.io/"><strong>Delta Lake</strong>:</a> Provides strong consistency and quality enforcement</li></ul><p>Each brings unique strengths to the table, but they all address the fundamental limitations of traditional Hive-based approaches by implementing modern table formats designed for cloud-native, high-performance analytics.</p><h3>What’s Next?</h3><p>In the next part of this series, I’ll dive deep into Apache Iceberg’s architecture and show you why it’s becoming the standard for modern data lakes. We’ll explore how it handles everything from schema evolution to time travel queries, and why it might be the perfect solution for your data challenges.</p><p>Stay tuned for Part 2: <a href="https://medium.com/@anzanfas/apache-iceberg-series-part-2-under-the-hood-ce2eb14e838c"><strong>Apache Iceberg Under the Hood</strong></a>!</p><p><em>Note: This is part 1 of a 3-part series on Apache Iceberg and modern data lakehouse architectures.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50019e91eeb1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cassandra Vs MongoDb(Comparing In hands-on way)Part -1]]></title>
            <link>https://medium.com/@anzanfas/cassandra-vs-mongodb-comparing-in-hands-on-way-part-1-d267283e3587?source=rss-6aa22c4224b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/d267283e3587</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[cassandra]]></category>
            <category><![CDATA[nosql]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Ahamed Arshad]]></dc:creator>
            <pubDate>Sun, 23 Jun 2019 19:14:07 GMT</pubDate>
            <atom:updated>2019-06-23T19:14:07.364Z</atom:updated>
            <content:encoded><![CDATA[<p>Through this post i am Going to explore and Contrast the Most used Databases Cassandra and MongoDb By experimenting two types of structured and unstructured Datasets. Basically on the early stages we used the Sql type of databases to Deal with Structured data.Then by the evolution in the Advanced technology the Data structure get more complex and it tense to the unstructured Type of Data Format.Then No-Sql Databases came into big picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HP-2dLox4KYJLAaBl7IHkA.jpeg" /><figcaption>The Red seems like Mongo Db(lolz)</figcaption></figure><p>So Lets Stop From Here about more Theories and Lets Get our Hand’s Dirty..</p><h4><strong>Installation</strong></h4><ol><li><strong>MongoDB.</strong></li></ol><p>You Could Download The MongoDb From <a href="https://www.mongodb.com/download-center/community">Here</a>…………..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*AYBzeBeAbZzG4ZUuoMmu1Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/1*t3QSynBAJRwVrOIaABlOAg.png" /></figure><p>2.<strong>Cassandra.</strong></p><p>You Could Download The Cassandra From <a href="https://academy.datastax.com/planet-cassandra/cassandra">Here</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*nh97jQuZiPglz7Bd" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*mrIu3HedhcRX7GoQ" /></figure><p>if you need to know about the installation ,MongoDb is easy but You can find some tutorials in web for Cassandra or else for Cassandra you can use a Cassandra docker container.</p><p>Now we are ready with the installations.Lets Query..This Experiment will be Conducted By inserting the structured and unstructured data to both Databases and measuring the query time.Lets Start with the structured Data …</p><p><em>NOTE : Below Structured data experiments are did using </em><a href="https://www.stats.govt.nz/large-datasets/csv-files-for-download/"><em>this</em></a><em> dataset(</em><strong><em> Annual enterprise survey: 2017 financial year (provisional) — CSV</em></strong><em>).Also i am very Sorry For The variable Names That i use </em>😉<em>.</em></p><p><strong>MongoDB</strong></p><ul><li>MongoDB is an document-oriented database that provides high availability, high performance and automatic scaling.</li><li>It is a NoSQL database which provide facilities to store and retrieve data which are not in tabular format. Therefore MongoDB is a very reliable tool for Big Data management.</li><li>MongoDB stores data in JSON format. It is designed to manage JSON-like documents which helps to access data easier and faster.</li><li>As MongoDB is a document-oriented database, it is schema less. Therefore it helps to design the schema according to user requirement.</li></ul><p>First Make The Mongo up and Running….</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yswGpWO7Mc1czEYD1YNL5A.png" /><figcaption>Terminal Show that it got started…</figcaption></figure><ol><li>Creating Database in mongo..</li></ol><p>* In this scenario, MongoDB operations were carried out using Pymongo(a library to import to build a python-Mongodb pipeline for Data Flow)</p><ul><li>In this case, a database was created with the name “test” and the dataset was saved in the collection called “CPrice” as follows</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/0*3r6v9cETkDTaxwr2" /></figure><p>According to the above image the time consumed to insert data is 0.532 seconds</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*Pxv4QtZvQN6s3dqhLNdxiQ.gif" /><figcaption>Query Time BUDDY………………..</figcaption></figure><p>2. The following queries were used to retrieve data from the database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/0*SImFe7coOGtd5T9Y" /></figure><p>Above query retrieve documents which contain Industry_aggregation as “Level 4” using <strong>find() </strong>method and get the count using the aggregation function, <strong>count()</strong>.</p><p>The time taken for the query performance is 0.0182 seconds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/0*IvddBvc12JzykoNO" /></figure><p>Above query retrieve documents in which the “Variable_category” starts with word combination “Fina” using <strong>regular expressions </strong>and the count is taken using the aggregation function.</p><p>The time taken for query performance is 0.03 seconds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/0*4rUZOkMwuZ-BlANl" /></figure><p>The aggregation function <strong>group() </strong>was used to count the number of documents having Industry code as 99999 in 2017, after grouping the documents by year field. According to the query performed, 155 documents were identified.</p><p>Now Lets Move on to Cassandra And try it in there…</p><p><strong>Cassandra</strong></p><ul><li>Cassandra is a distributed database from Apache that is highly scalable and designed to manage very large amounts of structured data. It provides high availability with no single point of failure.</li><li>The below figure shows a schematic view of how Cassandra uses data replication among the nodes in a cluster to ensure no single point of failure..</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/0*50CohsvFEC5u2t6D" /><figcaption>Cassandra and Data Replicas</figcaption></figure><ul><li>Users can access Cassandra through its nodes using Cassandra Query Language (CQL). CQL treats the database (Keyspace) as a container of tables. Programmers use cqlsh: a prompt to work with CQL or separate application language drivers.</li></ul><ol><li>The keyspace called “test” was created using the below query Using CQL Shell</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*Y4ol8CeFw60KpPvatKTHfg.png" /></figure><ul><li>Then to insert the csv file below query was created as “ColumnFamily” to map the data in CSV to Cassandra</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/0*9beTH2B_wfaWcXIJ" /></figure><p>Then the CSV was mapped to the keyspace using the COPY command in cassandra</p><p>COPY annual(annual_id,Year,Industry_aggregation_NZSIOC,Industry_code_NZSIOC,Industry_name_NZSIOC,Units,Variable_code,Variable_name,Variable_category,Value,Industry_code_ANZSIC06) FROM ‘annual.csv’ WITH DELIMITER = ‘,’ AND HEADER = TRUE;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*66xA9_A5n7SkQFXX" /></figure><p>Here the query execution time was identified as 3.314 sec to insert the CSV to cassandra.</p><p>2. The following queries were used to retrieve data from the database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sA9vhhmWsczxJfav" /></figure><p>Above query retrieve counts which contain Industry_aggregation as “Level 4” using <strong>session prepared </strong>method and get the count using the aggregation function, <strong>count()</strong>.</p><p>The time taken for the query performance is 0.20541 seconds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HTgGiyAKArWAnYoj" /><figcaption>Error******</figcaption></figure><p>Above query is to retrieve results in which the “Variable_category” starts with word combination “Fina” using <strong>regular expressions </strong>and the count is taken using the aggregation function.</p><p>Hold For a moment and we will brief all with the next error……</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RMELgkpeZd_j4gMm" /></figure><p>Above function is to count the number of documents having Industry code as 99999 in 2017, we have sed grouping the documents by year field.</p><p>But there are no functions as <strong>Like </strong>and <strong>Group By</strong> in Cassandra</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/0*vbn2AXcuhNpua5pT" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nDOR4o8N87FmkI2-" /><figcaption>Stack Overflow Reference..</figcaption></figure><p>On the Part 2 of this Blog i will analyze Some more Interesting Queries with the Unstructured Dataset which is (Donald Trump TWEETS Kaggle )dataset..Finally i will conclude all of this..stay Tuned</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d267283e3587" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Understanding on Embedding(For Beginners)]]></title>
            <link>https://medium.com/@anzanfas/my-understanding-on-embedding-for-beginners-c149d67ea7fd?source=rss-6aa22c4224b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/c149d67ea7fd</guid>
            <category><![CDATA[embedding]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[entity-embedding]]></category>
            <category><![CDATA[categorical]]></category>
            <dc:creator><![CDATA[Ahamed Arshad]]></dc:creator>
            <pubDate>Wed, 20 Feb 2019 14:37:43 GMT</pubDate>
            <atom:updated>2024-08-22T21:27:12.342Z</atom:updated>
            <content:encoded><![CDATA[<h3>My Understanding on Entity-Embedding</h3><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><p>This post mainly focuses on the description of the entity-embedding concept in a simple and engaging manner. In the machine learning aspect or when it comes to deep learning somehow, we need to deal with the categorical variables. Some of the categorical features are important and we need to use it while we are fixing the model. Consider the situation when you are having 3 or 4 categories(Ex:[Apple, Chicken, Broccoli]). Here we can use our usual concepts like label encoding or one hot encoding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ezGOW_jDDvZ9jCjHTj7hLg.jpeg" /><figcaption>Label Encoding VS One Hot Encoding</figcaption></figure><p>According to the above example, We can feed the One Hot Encoding for our Model and we can predict the outcome which we require but Label Encoding has bigger values like 3, 2 so our algorithm will give more preference to the higher values. Therefore we label encode and move to One hot Encoding. There are some situations we can omit the one hot encoding(Certain, this was identified when I fit a RandomForest Model). There are 3 categories in this scenario and this looks into a few questions like, What will happen if we have Many categories(Ex:45 categories) and we perform one hot encoding and feed it to a model? This would be computationally expensive because the matrix is sparse. Therefore, how do we overcome this issue?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*kqk66hqVcJE39usFf2VWnA.jpeg" /><figcaption><strong>WTF</strong></figcaption></figure><p>This is when embedding comes into place. The process that takes place here is we take a category and create a weight matrix (Embedding Matrix). Just look at this Below Image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y7i30ZFbHQacOvi8WsNriw.png" /><figcaption>Fig 1</figcaption></figure><p>In this scenario, I have considered a particular column has 7 categories and there you can see that category is one-hot-encoded.But we are not multiplying here using the total one hot encoded vector. We are just mapping using that vector(it used as a pointer). That indicates which row of the embedding Matrix should be the input. I will Visualize the concept on my words. In order to help grasp the idea of the process</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2OK36x-M2eVTEE8WOJWRBA.png" /><figcaption>Fig 2(Sorry For my Messy Handwriting ;-) )</figcaption></figure><p>If you go to the fig.1 There is the 2nd layer. This is where all other numerical columns will be added as input and simultaneously embeddings will be applied for multiple columns as well. The picture below clearly explains there is an embedding added for the movie index and user index as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bUK23odt69F5jk0fFH_HNw.png" /><figcaption>Embedding In complete big picture</figcaption></figure><p>Embedding is also used in dimensionality reduction purposes. It is similar to converting the data From high dimension to lower dimension for visualizing purposes( t-Distributed Stochastic Neighbor Embedding (T-SNE)). I will try to explore and write about PCA and T-SNE in my next blog. However, I will suggest you read through below link this will help you to explore the concepts in depth and in hands-on -way.</p><p>(<a href="https://www.kaggle.com/learn/embeddings?utm_medium=email&amp;utm_source=intercom&amp;utm_campaign=nov-newsl-learn-colin">https://www.kaggle.com/learn/embeddings?utm_medium=email&amp;utm_source=intercom&amp;utm_campaign=nov-newsl-learn-colin</a> ).</p><p>Paper =&gt; <a href="https://arxiv.org/abs/1604.06737">https://arxiv.org/abs/1604.06737</a></p><p>It’s a general technique that has been leveraged by competitors to achieve better performance in Kaggle competitions.</p><p><em>Happy machine learning…..!</em></p><p>Any act of correction is appreciated.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c149d67ea7fd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>