<?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 Harsh Kumar on Medium]]></title>
        <description><![CDATA[Stories by Harsh Kumar on Medium]]></description>
        <link>https://medium.com/@harsh11csb?source=rss-b7be42fe65fc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ESmCVD6OBRYWDbzi0Ek4ug.jpeg</url>
            <title>Stories by Harsh Kumar on Medium</title>
            <link>https://medium.com/@harsh11csb?source=rss-b7be42fe65fc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 25 Nov 2026 02:22:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@harsh11csb/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[Advanced SQL Interview Questions for Data Engineers]]></title>
            <link>https://medium.com/@harsh11csb/advanced-sql-interview-questions-for-data-engineers-dd028ec4121c?source=rss-b7be42fe65fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd028ec4121c</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[advance-sql]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[databricks]]></category>
            <dc:creator><![CDATA[Harsh Kumar]]></dc:creator>
            <pubDate>Thu, 28 May 2026 06:03:30 GMT</pubDate>
            <atom:updated>2026-05-28T06:03:30.511Z</atom:updated>
            <content:encoded><![CDATA[<p>Today we are going to dicuss the SQL question medium to advance level for interview:</p><ol><li>You have given 3 tables and a query your task is to optimized the query</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*TkcBCC8-s_8fPPETUYMlcA.png" /></figure><pre>SELECT *<br>FROM (<br>    SELECT *<br>    FROM orders<br>    WHERE YEAR(order_date) = 2025  <br>      AND order_id IN (<br>          SELECT order_id<br>          FROM payments<br>          WHERE payment_status = &#39;SUCCESS&#39;<br>      )<br>      AND user_id IN (<br>          SELECT user_id<br>          FROM users<br>          WHERE country &lt;&gt; &#39;India&#39;<br>      )<br>) o;</pre><p>Expectation for you to ask these question intead of directly optimize the query:</p><ol><li>Table Partitions</li><li>Table size</li><li>columns required for selection</li></ol><p>Soln:</p><ol><li>Convert sub query to joins</li><li>broadcast the samll table like user</li><li>remove year fucntionality and change for partitoi prunig. Year function will be allid on all partitions</li><li>select only required columns</li></ol><pre>SELECT /*+ BROADCAST(u) */<br>    o.order_id,<br>    o.user_id,<br>    o.order_date,<br>    o.amount,<br>    p.payment_status,<br>    u.country<br>FROM orders o<br>JOIN payments p<br>    ON o.order_id = p.order_id<br>    AND p.payment_status = &#39;SUCCESS&#39;<br>JOIN users u<br>    ON o.user_id = u.user_id<br>    AND u.country &lt;&gt; &#39;India&#39;<br>WHERE o.order_date &gt;= &#39;2025-01-01&#39;<br>  AND o.order_date &lt;  &#39;2026-01-01&#39;;</pre><p>2. A table is given with two columns service i.e apps/sites wher you order things online and second column is city meaning where they rvide services</p><p>Your task is to write a uery to identify the which service is not avaible in which city.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*5QD1cEowPDX2DYeT36OA0Q.png" /></figure><p>Expectation:</p><p>Testing self joining capability with or without CTE</p><p>You ahve experience on joins apart for inner left or right like anti joins:</p><pre>WITH all_services AS (<br>    SELECT DISTINCT service FROM your_table<br>),<br>all_cities AS (<br>    SELECT DISTINCT city FROM your_table<br>)<br><br>SELECT <br>    s.service,<br>    c.city AS City_NotAvailable<br>FROM all_services ss<br>CROSS JOIN all_cities c<br>LEFT ANTI JOIN your_table t<br>    ON s.service = t.service<br>   AND c.city = t.city<br>ORDER BY s.service;</pre><p>3. Simple and Straightforward:<br>You are given an input and the expected output directly. There are no complications-just a straightforward SQL query is required, and the input remains constant.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/192/1*ZHa0gOwLPTHz9a6rNLKUQQ.png" /></figure><p>Expectation:<br>Quick thinking and the ability to write the query fast without overcomplicating the solution.</p><pre>select a.num from table a inner join temp b on a.num&gt;=b.num</pre><p>Also, be prepared to write basic SQL joins, including INNER JOIN queries.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd028ec4121c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Would Learn Data Engineering in 1 Year If I Were in College Again]]></title>
            <link>https://medium.com/@harsh11csb/how-i-would-learn-data-engineering-in-1-year-if-i-were-in-college-again-9ec857d707b1?source=rss-b7be42fe65fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ec857d707b1</guid>
            <category><![CDATA[learn-data-engineering]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-roadmap]]></category>
            <dc:creator><![CDATA[Harsh Kumar]]></dc:creator>
            <pubDate>Wed, 11 Mar 2026 05:23:59 GMT</pubDate>
            <atom:updated>2026-03-11T05:23:59.356Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re in your <strong>2nd or 3rd year of college</strong> and thinking about becoming a <strong>Data Engineer</strong>, the biggest challenge is not <em>what to learn</em>, but <strong>in what order to learn things</strong>. Many students jump directly into too many tools — Kafka, Spark, cloud platforms — without building strong fundamentals first.</p><p>This article outlines a <strong>practical 1-year roadmap</strong> to help you build the right foundation and gradually move toward industry-level Data Engineering skills.</p><h3>Phase 1: First 2–3 Months — Build the Foundation</h3><p>Your first goal should be to build <strong>strong problem-solving and data querying skills</strong>.</p><h3>1. Learn SQL and Practice Daily</h3><p>SQL is the <strong>most important skill for a Data Engineer</strong>. Almost every data pipeline eventually involves querying or transforming data.</p><p>Focus on learning:</p><ul><li>SELECT, WHERE, GROUP BY</li><li>JOINs (INNER, LEFT, RIGHT)</li><li>Window Functions</li><li>Aggregations</li><li>Subqueries and CTEs</li></ul><p>Practice SQL <strong>every day</strong> on platforms like:</p><ul><li>LeetCode</li><li>HackerRank</li><li>StrataScratch</li></ul><p>The key is <strong>practice while learning</strong>, not after finishing the theory.</p><h3>2. Practice Data Structures and Algorithms (DSA)</h3><p>While learning SQL, also practice <strong>DSA problems on LeetCode</strong>. This is especially important if you are targeting <strong>Tier-1 product companies</strong> such as Amazon, Walmart, or Uber.</p><p>Focus on:</p><ul><li>Arrays</li><li>HashMaps</li><li>Strings</li><li>Sliding Window</li><li>Basic recursion</li></ul><p>You don’t need extremely advanced algorithms initially. The goal is to <strong>build logical thinking and coding discipline</strong>.</p><h3>Phase 2: Months 3–6 — Start Learning PySpark</h3><p>Once you are comfortable with <strong>SQL and basic DSA</strong>, it’s time to move to <strong>big data processing</strong>.</p><h3>Why PySpark?</h3><p>Most modern data pipelines process <strong>large-scale data</strong>, and frameworks like <strong>Apache Spark</strong> are widely used.</p><p>Start learning:</p><ul><li>Spark DataFrames</li><li>Reading and writing files</li><li>Basic transformations</li><li>Filtering and aggregations</li><li>Joins in Spark</li></ul><p>At this stage:</p><ul><li><strong>Slow down SQL slightly</strong></li><li><strong>Continue DSA practice</strong></li><li>Focus on <strong>hands-on PySpark practice</strong></li></ul><h3>Phase 3: Learn PySpark with Cloud Platforms ☁️</h3><p>Now combine <strong>PySpark with cloud environments</strong>.</p><p>Choose <strong>one cloud platform</strong>:</p><ul><li>AWS</li><li>GCP</li><li>Azure</li></ul><p>But don’t focus on cloud-specific services too deeply yet.</p><p>Instead, learn <strong>common concepts shared across all clouds</strong>:</p><ul><li>Storage (S3, GCS, Blob Storage)</li><li>Compute</li><li>Batch data processing</li></ul><p>Avoid going too deep into <strong>cloud-only tools early</strong>. Your goal is to understand <strong>data processing patterns</strong>, not just cloud services.</p><p>By this stage (around <strong>5–6 months</strong>), you should already have a good understanding of:</p><ul><li>SQL</li><li>DSA basics</li><li>PySpark fundamentals</li><li>Basic cloud usage</li></ul><h3>Phase 4: Months 6–8 — Start Building Projects</h3><p>Now it’s time to <strong>apply your knowledge through projects</strong>.</p><p>Start with <strong>simple datasets</strong> available on platforms such as:</p><ul><li>Kaggle</li><li>data.gov</li></ul><h3>Practice with Multiple Datasets</h3><p>Try working on <strong>at least 5 different datasets</strong>.</p><p>For each dataset:</p><ol><li>Write SQL queries to analyze the data</li><li>Solve the same problem using PySpark</li></ol><p>This helps you understand the <strong>difference between traditional SQL processing and distributed data processing</strong>.</p><h3>Phase 5: Go Deeper into Internals 🔍</h3><p>Now that you have hands-on experience, it’s time to understand <strong>how things actually work internally</strong>.</p><p>Learn about:</p><h3>PySpark Internals</h3><ul><li>Spark execution model</li><li>DAG (Directed Acyclic Graph)</li><li>Lazy evaluation</li><li>Shuffle operations</li><li>Partitioning</li></ul><h3>Database Internals</h3><p>Understand how data moves through a pipeline:</p><pre>Input File → Processing → Transformation → Output</pre><p>This knowledge helps you write <strong>efficient pipelines instead of just functional ones</strong>.</p><h3>Phase 6: Build an End-to-End ETL Pipeline</h3><p>Now build a <strong>complete project</strong> that simulates a real-world data pipeline.</p><p>Example pipeline:</p><pre>Raw Data → Ingestion → Processing → Transformation → Storage → Analytics</pre><h3>Example Project</h3><p><strong>E-commerce Data Pipeline</strong></p><ol><li>Raw transaction files arrive daily</li><li>PySpark processes the files</li><li>Data is cleaned and transformed</li><li>Output stored in optimized formats</li><li>SQL used for analytics queries</li></ol><p>This project will demonstrate <strong>real Data Engineering workflows</strong>.</p><h3>Phase 7: Batch vs Streaming</h3><p>Once you are comfortable with batch pipelines, understand the difference between:</p><h3>Batch Processing</h3><p>Processes data <strong>at intervals</strong>.</p><p>Example:</p><pre>Daily sales reports<br>Monthly financial reports</pre><h3>Streaming Processing</h3><p>Processes data <strong>in real-time</strong>.</p><p>Example:</p><pre>User click tracking<br>Real-time fraud detection</pre><p>Understanding this difference is critical for modern Data Engineering.</p><h3>Phase 8: Add Advanced Technologies</h3><p>Now expand your tech stack.</p><p>Learn about:</p><h3>Kafka</h3><p>Used for <strong>real-time data streaming</strong>.</p><h3>File Formats</h3><p>Understanding file formats is extremely important in data engineering.</p><p>Learn:</p><ul><li>Parquet</li><li>ORC</li><li>Avro</li></ul><p>Each format has different <strong>compression, storage, and performance benefits</strong>.</p><p>Try adding these technologies into your project and observe how your pipeline <strong>evolves from basic to production-like architecture</strong>.</p><h3>Phase 9: Data Modeling and Pipeline Architecture</h3><p>One of the most important skills for Data Engineers is <strong>designing data systems</strong>.</p><p>Learn concepts such as:</p><ul><li>Data modeling</li><li>Star schema</li><li>Fact and dimension tables</li><li>Pipeline architecture</li><li>Data lake vs data warehouse</li></ul><p>Understanding <strong>how to design pipelines</strong> is often more valuable than just knowing tools.</p><h3>Suggested Tech Stack for Freshers</h3><p>By the end of this roadmap, your resume should include:</p><p><strong>Core Skills</strong></p><ul><li>SQL</li><li>PySpark</li><li>Python or Scala</li></ul><p><strong>Data Engineering Technologies</strong></p><ul><li>Kafka</li><li>Parquet / ORC / Avro</li><li>ETL pipelines</li><li>Airflow</li></ul><p><strong>Cloud Basics</strong></p><ul><li>Storage</li><li>Compute</li><li>Data processing</li></ul><h3>Bonus: Familiarize Yourself with Industry Tools</h3><p>Once your fundamentals are strong, you can explore platforms like:</p><ul><li>Databricks</li><li>Snowflake</li></ul><p>You don’t need <strong>deep expertise initially</strong>, but basic familiarity can be an advantage.</p><h3>Final Advice for Students 🎯</h3><p>If you follow this roadmap consistently, within <strong>one year</strong> you will have:</p><ul><li>Strong SQL skills</li><li>Good problem-solving ability</li><li>Hands-on experience with PySpark</li><li>Real projects</li><li>Understanding of data pipeline architecture</li></ul><p>For a <strong>college student or fresher</strong>, this is <strong>more than enough to start applying for Data Engineering roles</strong>.</p><p>Remember:</p><blockquote><em>Focus on </em><strong><em>fundamentals + projects</em></strong><em>, not just tools.</em></blockquote><p>Tools change every few years, but <strong>strong fundamentals stay relevant throughout your career</strong>.</p><p><strong><em>Next Post will discuss How to build a project as a college student.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ec857d707b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Slowly Changing Dimensions (SCD)- With Example]]></title>
            <link>https://medium.com/@harsh11csb/slowly-changing-dimensions-scd-with-example-8e1de2e65564?source=rss-b7be42fe65fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e1de2e65564</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[scd]]></category>
            <category><![CDATA[data-modeling]]></category>
            <dc:creator><![CDATA[Harsh Kumar]]></dc:creator>
            <pubDate>Wed, 18 Feb 2026 09:16:33 GMT</pubDate>
            <atom:updated>2026-02-18T09:16:33.666Z</atom:updated>
            <content:encoded><![CDATA[<h3>Sample Financial Dataset</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*-V4UUw6rgK60onD_5K4fQw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ojyWnaDk2m35SwK6p_81cg.png" /></figure><h3>SCD Type 0 — Fixed Dimension (No Change Allowed)</h3><h3>Financial Use Case:</h3><p><strong>Date of Birth, PAN Number, Aadhaar Number</strong></p><p>These <strong>must never change</strong> after onboarding.</p><h3>SCD Type 1 — Overwrite (No History)</h3><p>Correcting <strong>typos in name or city</strong></p><h3>SQL:</h3><pre>MERGE INTO dim_customer tgt<br>USING stg_customer src<br>ON tgt.customer_id = src.customer_id<br>WHEN MATCHED THEN<br>UPDATE SET<br>  tgt.name = src.name,<br>  tgt.city = src.city,<br>  tgt.kyc_status = src.kyc_status;</pre><h3>Result:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*6DDa0FI4d4Dt7w45eaUSjA.png" /></figure><p>👉 <strong>No history maintained</strong></p><h3>SCD Type 2 — Full Historical Tracking (Most Important in Finance)</h3><h3>Financial Use Case:</h3><p>Track <strong>address change, KYC updates, risk rating changes</strong> for:</p><ul><li>Audit</li><li>Regulatory compliance</li><li>Risk analytics</li></ul><h3>Step 1 — Expire Old Record</h3><pre>UPDATE dim_customer<br>SET end_date = CURRENT_DATE - 1,<br>    is_current = false<br>WHERE customer_id IN (SELECT customer_id FROM stg_customer)<br>  AND is_current = true;</pre><h3>Step 2 — Insert New Record</h3><pre>INSERT INTO dim_customer<br>SELECT<br>  nextval(&#39;cust_sk_seq&#39;),<br>  customer_id,<br>  name,<br>  city,<br>  kyc_status,<br>  risk_rating,<br>  CURRENT_DATE,<br>  &#39;9999-12-31&#39;,<br>  true<br>FROM stg_customer;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MK-4x4JmGmKqWEGaHxqJlQ.png" /></figure><p>👉 <strong>Full audit history preserved</strong></p><h3>SCD Type 3 — Limited History (Current + Previous)</h3><h3>Financial Use Case:</h3><p>Track <strong>current and previous risk rating</strong> only.</p><h3>Table:</h3><p>customer_idcurrent_riskprevious_risk</p><h3>SQL:</h3><pre>UPDATE dim_customer<br>SET<br>  previous_risk = current_risk,<br>  current_risk = src.risk_rating<br>FROM stg_customer src<br>WHERE dim_customer.customer_id = src.customer_id;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*_1GMzzh2sbHqu99a0LUWdw.png" /></figure><p>👉 Used for <strong>risk comparison dashboards</strong></p><h3>SCD Type 4 — Separate History Table (Audit Optimized)</h3><h3>Financial Use Case:</h3><p>Maintain <strong>complete audit trail</strong> in a <strong>separate history table</strong> for️</p><h3>Tables:</h3><ul><li>dim_customer_current</li><li>dim_customer_history</li></ul><h3>SQL:</h3><pre>INSERT INTO dim_customer_history<br>SELECT * FROM dim_customer_current<br>WHERE customer_id IN (SELECT customer_id FROM stg_customer);</pre><pre>UPDATE dim_customer_current tgt<br>SET<br>  city = src.city,<br>  kyc_status = src.kyc_status,<br>  risk_rating = src.risk_rating<br>FROM stg_customer src<br>WHERE tgt.customer_id = src.customer_id;</pre><h3>Result:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*jDeUx9PMQhyVLEhndNrCLw.png" /></figure><p>👉 Best for <strong>audit-heavy systems &amp; regulators</strong></p><h3>Interview Scenarios (With Explanation)</h3><h3>Question:</h3><p>You receive three datasets:</p><ol><li>Clickstream Data</li><li>Customer Data</li><li>Website Metadata</li></ol><p>Identify <strong>dimension tables</strong> and explain <strong>why</strong>.</p><h3>1️. Clickstream Data</h3><p><strong>Sample Fields:</strong><br> event_time, user_id, page_url, action, device</p><h3>Type:</h3><p>👉 <strong>Fact Table</strong></p><h3>Why:</h3><ul><li>Event-based</li><li>High-volume</li><li>Transactional</li><li>Used for metrics: clicks, sessions, conversions</li></ul><h3>️️2. Customer Data</h3><p><strong>Sample Fields:</strong><br> customer_id, name, email, city, age</p><h3>Type:</h3><p>👉 <strong>Dimension Table (SCD Type 2)</strong></p><h3>Why:</h3><ul><li>Descriptive</li><li>Changes slowly</li><li>History needed for:</li></ul><p>-&gt;Customer analytics</p><p>-&gt;Compliance</p><p>&gt;Trend analysis</p><h3>3️. Website Metadata</h3><p><strong>Sample Fields:</strong><br> page_id, category, url, content_type</p><h3>Type:</h3><p>👉 <strong>Dimension Table (SCD Type 1 / Type 3)</strong></p><h3>Why:</h3><ul><li>Descriptive attributes</li><li>Slowly changing</li><li>No need for deep history usually</li></ul><h3>Final Interview Summary Table</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*wuB8Il_WuGjvZVrWwjMMwg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e1de2e65564" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rolling Key Encryption: Azure/AWS KMS with Unity Catalog vs DB Secrets]]></title>
            <link>https://medium.com/@harsh11csb/rolling-key-encryption-azure-aws-kms-with-unity-catalog-vs-db-secrets-11d7ab356571?source=rss-b7be42fe65fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/11d7ab356571</guid>
            <category><![CDATA[databricks-unity-catalog]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[encryption]]></category>
            <category><![CDATA[databricks]]></category>
            <dc:creator><![CDATA[Harsh Kumar]]></dc:creator>
            <pubDate>Thu, 12 Feb 2026 10:23:20 GMT</pubDate>
            <atom:updated>2026-02-12T10:23:20.125Z</atom:updated>
            <content:encoded><![CDATA[<p>As data platforms mature, <strong>security, compliance, and governance</strong> become first-class requirements. Encryption at rest is no longer optional -but how encryption keys are managed often determines the overall <strong>security posture, operational complexity, and compliance readiness</strong> of a platform.</p><p>In modern Databricks-based architectures, two common approaches emerge:</p><ol><li><strong>Azure/AWS KMS integrated with Databricks Unity Catalog (UC)</strong></li><li><strong>Databricks Secrets-based key storage with custom encryption functions</strong></li></ol><p>This article compares both approaches, explaining <strong>how they work, their architectural trade-offs, and which approach fits enterprise-grade workloads best.</strong></p><h3>Why Key Management Matters</h3><p>Encryption is only as strong as its <strong>key management strategy</strong>. Poor key handling leads to:</p><ul><li>Increased risk of <strong>data breaches</strong></li><li><strong>Compliance violations</strong> (GDPR, HIPAA, PCI-DSS, SOC2)</li><li>Manual operational overhead</li><li>Key leakage to developers or platform admins</li></ul><p>Enterprise platforms therefore rely on <strong>centralized Key Management Systems (KMS)</strong> that provide:</p><ul><li>Secure key storage (HSM-backed)</li><li>Automated rotation</li><li>Fine-grained access control</li><li>Full audit logging</li></ul><p>Databricks supports deep integration with <strong>cloud-native KMS</strong> through <strong>Unity Catalog</strong>, making secure encryption almost transparent to users.</p><h3>Architecture Overview: Envelope Encryption Model</h3><p>Databricks uses a standard <strong>envelope encryption model</strong>:</p><ul><li><strong>DEK (Data Encryption Key)</strong> encrypts actual data.</li><li><strong>KEK (Key Encryption Key)</strong> encrypts the DEK.</li><li>Encrypted DEKs are stored in metadata.</li><li>KEKs are securely stored inside <strong>Azure Key Vault or AWS KMS</strong>.</li></ul><p>This design ensures:</p><ul><li>Data keys never appear in plaintext storage.</li><li>Master keys remain inside secure HSM-backed services.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*oT_TE8QOLVExjmOa_9A1rA.png" /></figure><h3>🔐 Encryption Flow</h3><ol><li>Plain data is sent to the encryption engine.</li><li>A Data Encryption Key (DEK) is generated and split into <strong>plain key (in-memory)</strong> and <strong>encrypted key (wrapped by KEK)</strong>.</li><li>The <strong>plain DEK encrypts the data</strong> to produce encrypted data.</li><li>The <strong>encrypted DEK is stored in metadata</strong>, while encrypted data is stored in storage.</li></ol><h3>🔓 Decryption Flow</h3><ol><li>Encrypted data and encrypted DEK are fetched from storage and metadata.</li><li>Encrypted DEK is decrypted using KEK to regenerate the plain DEK.</li><li>Plain DEK is used to decrypt the encrypted data and retrieve original data.</li></ol><h3>Option 1: Azure/AWS KMS with Databricks Unity Catalog (UC)</h3><h3>How It Works</h3><p>In this model:</p><ul><li><strong>Encryption &amp; Decryption are fully managed by Databricks Unity Catalog.</strong></li><li><strong>KEK is managed by Azure Key Vault or AWS KMS.</strong></li><li><strong>DEK is managed internally by Unity Catalog.</strong></li><li>Applications and users <strong>do not write encryption or decryption code</strong>.</li></ul><h3>Key Characteristics</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*nhbFADXLho7IFdbTRPUUpg.png" /></figure><h3>Advantages</h3><p><strong>1. Centralized Security Control</strong><br> All encryption policies, permissions, and auditing are managed centrally through Unity Catalog and cloud IAM.</p><p><strong>2. Zero Code Overhead</strong><br> Developers simply read and write data. Encryption and decryption happen transparently.</p><p><strong>3. Secure Key Storage</strong><br> Keys never leave cloud-native HSM-backed KMS services.</p><p><strong>4. Automatic Key Rotation</strong><br> No operational overhead or manual intervention.</p><p><strong>5. Tight Integration with Databricks</strong><br> Native integration ensures:</p><ul><li>High performance</li><li>Minimal latency</li><li>Seamless governance</li></ul><h3>Limitations</h3><p><strong>1. Additional Cost for Key Operations</strong><br> Cloud KMS services charge for:</p><ul><li>Key storage</li><li>API calls</li><li>Rotation operations</li></ul><p><strong>4. Table-Level Granularity</strong><br> Encryption policies operate primarily at the table level.</p><h3>Option 2: Databricks Secrets-Based Key Storage (DB Secret)</h3><h3>How It Works</h3><p>In this model:</p><ul><li>KEK and DEK are stored inside <strong>Databricks Secrets</strong>.</li><li>Developers must write <strong>custom encryption and decryption functions</strong>.</li><li>Key rotation and access control become <strong>manual responsibilities</strong>.</li></ul><h3>Key Characteristics</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*P6NbK1FxMLNq8qSE_v1Pog.png" /></figure><h3>Advantages</h3><p><strong>1. Simple Storage</strong><br> No dependency on external KMS systems.</p><p><strong>2. Tight Databricks Integration</strong><br> Native secret APIs provide easy access.</p><h3>Limitations</h3><p><strong>1. High Security Risk</strong><br> Keys can become <strong>visible to platform admins, leads, and developers</strong>, increasing the attack surface.</p><p><strong>2. Manual Key Rotation</strong><br> Operational burden increases exponentially at scale.</p><p><strong>3. Performance Overhead</strong><br> Encryption &amp; decryption functions execute inside Spark jobs, adding <strong>runtime latency</strong>.</p><p><strong>4. Compliance Challenges</strong><br> Fails to meet strict regulatory requirements for <strong>key isolation and governance</strong>.</p><h3>Comparison Summary</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*hVBMsel-cChKya3oGH9WXA.png" /></figure><h3>Which Approach Should You Choose?</h3><h3>Choose Azure/AWS KMS with Unity Catalog if:</h3><ul><li>You are building <strong>enterprise-grade platforms</strong></li><li>You handle <strong>PII, financial, healthcare, or regulated data</strong></li><li>You need <strong>strong governance and auditing</strong></li><li>You want <strong>zero developer overhead</strong></li><li>You want <strong>future-proof security architecture</strong></li></ul><p>This is the <strong>recommended production architecture</strong>.</p><h3>Choose DB Secrets-based encryption if:</h3><ul><li>You are in <strong>early PoC or prototype phase</strong></li><li>You have <strong>low compliance requirements</strong></li><li>You need <strong>quick setup with minimal infrastructure</strong></li></ul><p>This should <strong>not be used for regulated or large-scale production workloads.</strong></p><h3>Final Recommendation</h3><p>For modern lakehouse architectures, <strong>Azure/AWS KMS integrated with Databricks Unity Catalog is the gold standard</strong>.</p><p>It offers:</p><ul><li>Native encryption</li><li>Centralized governance</li><li>Automatic rotation</li><li>Compliance readiness</li><li>Minimal operational risk</li></ul><p>DB Secrets-based encryption should remain limited to <strong>experimentation and non-sensitive workloads only.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11d7ab356571" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Low vs. High Cardinality in Delta Lake: The Hidden Factor Dictating Your Upsert Strategy]]></title>
            <link>https://medium.com/@harsh11csb/low-vs-high-cardinality-in-delta-lake-the-hidden-factor-dictating-your-upsert-strategy-0e571e25973f?source=rss-b7be42fe65fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/0e571e25973f</guid>
            <category><![CDATA[cardinality-estimation]]></category>
            <category><![CDATA[performance-optimization]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[databricks]]></category>
            <category><![CDATA[apache-spark]]></category>
            <dc:creator><![CDATA[Harsh Kumar]]></dc:creator>
            <pubDate>Sun, 01 Feb 2026 08:13:14 GMT</pubDate>
            <atom:updated>2026-02-01T08:13:14.513Z</atom:updated>
            <content:encoded><![CDATA[<p>Most Delta Lake performance problems do not start with Spark configurations or cluster sizes. They start with data modeling decisions that ignore <strong>cardinality</strong>.</p><p>Cardinality is a concept every data engineer knows, but few quantify effectively when designing Databricks Delta tables. You will often hear advice like “Use low-cardinality columns for partitioning” or “High-cardinality columns hurt performance.”</p><p><strong>But how low is “low”? How high is “high”? </strong>And what actually breaks in Delta Lake when you get this wrong?</p><p>Let’s put real numbers, real scenarios, and Databricks-specific behavior behind these terms.</p><h3>What Cardinality Really Means in Delta Lake</h3><p>Cardinality describes the number of distinct values in a column relative to the total number of rows.</p><p>Cardinality = Count of Distinct Values</p><p><strong>Real-world examples:</strong></p><ul><li><strong>Low Cardinality:</strong> status (3–10 values), currency (~150 values).</li><li><strong>Medium Cardinality:</strong> zip_code (~40,000 values), sku_category (~1,000 values).</li><li><strong>High Cardinality:</strong> user_id (Millions), transaction_id (Unique per row), timestamp (Infinite).</li></ul><p>In Databricks, cardinality dictates your <strong>physical layout strategy</strong>. It impacts partitioning, file sizing, data skipping (min/max statistics), and ultimately, the speed of your writes.</p><h3>Partitioning Depends on Low Cardinality</h3><p>Partitioning works best when the column has low cardinality. Each partition value maps to a physical directory. This allows Spark to perform <strong>Partition Pruning</strong> — skipping entire directories of data during reads.</p><p>A date partition (e.g., dt=2024-01-01) creates predictable partitions and keeps file counts manageable.</p><p><strong>The High Cardinality Trap:</strong> If you partition by a high-cardinality column (like user_id), you create the &quot;Small Files Problem.&quot; If you have 1 million users, you create 1 million directories. The metadata overhead to list these directories will choke the driver, slowing down query planning and causing write operations to fail.</p><p><strong>The Rule of Thumb:</strong> Only partition if a column allows you to segregate data into chunks of at least <strong>1 GB</strong> per partition. If the data volume is smaller, do not partition at all.</p><h3>Why MERGE Is Expensive by Design</h3><p>A Delta MERGE operation is often misunderstood as an &quot;update.&quot; In reality, it is a rewrite operation.</p><p><strong>The Execution Flow:</strong></p><ol><li><strong>Scan:</strong> Spark scans the source and target tables.</li><li><strong>Join:</strong> It joins the data to find matches.</li><li><strong>Rewrite:</strong> It identifies files containing <em>even a single</em> matched row.</li><li><strong>Commit:</strong> It rewrites the <em>entire</em> file to a new version.</li></ol><p><strong>The Bottleneck:</strong> The most “hurtful” step is the file rewrite. If you have a 1GB file and you update a single row within it, Delta Lake must read the 1GB file, modify the row in memory, and write a new 1GB file. This is high I/O overhead for a small change.</p><p>If your join condition uses a high-cardinality column that isn’t partitioned (or Z-Ordered), Spark scans massive amounts of data just to find the rows to update.</p><h3>INSERT OVERWRITE as a Scalable Alternative</h3><p>When data naturally aligns with a low-cardinality partition (like date), INSERT OVERWRITE is almost always the superior choice.</p><p>Instead of comparing rows (Read -&gt; Join -&gt;Rewrite), the pipeline simply replaces a specific directory with fresh data.</p><p><strong>The Execution Flow:</strong></p><ol><li><strong>Source:</strong> Read source data for the partition.</li><li><strong>Write:</strong> Write new files to the target partition directory.</li><li><strong>Commit:</strong> Mark old files as “removed” and new files as “added” in the transaction log.</li></ol><p>This avoids joins entirely. It avoids scanning unrelated partitions. It limits the “blast radius” of the write to a known scope. For daily ingestion pipelines, replacing a partition is roughly <strong>5x to 10x faster</strong> than merging into it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*f_7WaSyM90WHhkGfyzIn7w.png" /><figcaption>Execution Flow</figcaption></figure><p>The Most hurtful stpe in the flow is file scan and update which the insert overwrite avoid by just rewriting the whole thing again , think hard because it always comes to data which is better.</p><h3>Cardinality imapct on Z-ORDER</h3><p>Think of <strong>Z-Order</strong> like arranging books in a library so that similar topics are placed on the same shelf. When you look for one book, you don’t have to walk through the entire library.</p><p>Z-Order arranges data <em>inside</em> Delta files so that similar values sit close together. This maximizes the effectiveness of <strong>Data Skipping</strong> (using min/max stats in the Delta Log).</p><ul><li><strong>When to use:</strong> High cardinality columns frequently used in filters (user_id, order_id).</li><li><strong>The Caveat:</strong> Z-Order does <strong>not</strong> make writes faster. In fact, it makes writes slower because Spark has to sort the data before writing.</li></ul><p><strong>Critical Note:</strong> Do not Z-Order on your partition column. That is redundant. Partitioning physically separates data; Z-Ordering logically organizes it within those physical files.Data Skew Can Break Both Low and High Cardinality Designs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*_kx2vzqQsYAQpfra8oS1pg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*4LLjvaxSKYWccil0Yu7SAw.png" /></figure><h3>Final Takeaway</h3><p>Its the small decision of architecture creating big impact, SO choose Wisely.</p><p>Low cardinality defines how data should be partitioned.<br>High cardinality defines how data should be organized within files.</p><p>MERGE is powerful but costly and should not be the default choice. Most large scale Delta pipelines perform better when they rely on partition overwrite strategies and reserve MERGE for true row level change scenarios.</p><p>Understanding cardinality is not an optimization detail. It is the core design principle that determines whether your Delta Lake scales cleanly or struggles over time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0e571e25973f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Cleared the Databricks Professional Data Engineer Exam (Real Strategy, Not Just Practice…]]></title>
            <link>https://medium.com/@harsh11csb/how-i-cleared-the-databricks-professional-data-engineer-exam-real-strategy-not-just-practice-c14d3f7fa7d7?source=rss-b7be42fe65fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/c14d3f7fa7d7</guid>
            <category><![CDATA[databricks]]></category>
            <category><![CDATA[certification]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Harsh Kumar]]></dc:creator>
            <pubDate>Fri, 16 Jan 2026 08:47:17 GMT</pubDate>
            <atom:updated>2026-01-16T08:47:17.054Z</atom:updated>
            <content:encoded><![CDATA[<h3>How I Cleared the Databricks Professional Data Engineer Exam (Real Strategy, Not Just Practice Tests)</h3><p>Most people approach the Databricks Professional Data Engineer exam the wrong way. They focus on memorizing answers instead of understanding concepts. I cleared the exam by doing the opposite, and that made all the difference.</p><p>In this article, I’ll share how I prepared, what mindset helped me most, and what I would recommend if you are planning to take this exam.</p><h3>How I Studied</h3><p>My preparation mainly revolved around practice tests. I followed a Udemy practice exam course and attempted the tests multiple times until I consistently scored above 90 percent.</p><p>This is the course I used<br><a href="https://www.udemy.com/course/draft/6953931/learn/quiz/7309885/results?expanded=1750864111#overview">https://www.udemy.com/course/draft/6953931/learn/quiz/7309885/results?expanded=1750864111#overview</a></p><p>But scoring high was never the real goal.</p><p>After every test, I carefully reviewed each question, including the options that were wrong. This step is what truly helped me. I wanted to understand <em>why</em> one option worked and <em>why</em> the others didn’t.</p><h3>Concept Clarity Matters More Than Correct Answers</h3><p>One important thing to understand about this exam is that the questions are often tweaked.</p><p>A question you see in a practice test might appear in the real exam with slightly different wording or a small change in scenario. If you rely only on memorized answers, you will struggle.</p><p>For example, there are many questions around Delta Live Tables expectations, such as<br><em>a.</em> expect_all<br><em>b.</em> expect_or_fail<br><em>c.</em> expect_or_drop<br><em>d.</em> expect</p><p>Instead of remembering which option was correct in a test, I spent time learning when each expectation should be used. That way, even if the exam question was modified, I could still reason my way to the correct answer.</p><h3>A Real Example from Auto Loader Questions</h3><p>Auto Loader schema evolution is a very common topic in the exam.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*WSsVXzkmfiZnH0eMc9HlBw.png" /><figcaption>Sample Question</figcaption></figure><p>In this case, the correct answer is <strong>rescue</strong>.</p><p>Instead of stopping there, I also made sure I understood when the other options would be correct. This helped me build confidence, because I knew that even if the question was reworded in the exam, I would still know how to answer it.</p><p>This mindset of learning beyond the correct option helped me across many topics in the exam.</p><h3>Topics Covered in the Exam</h3><p>As of December 2025, the Databricks Professional Data Engineer exam roughly covers the following areas.</p><p>The exam covers:</p><ol><li>Developing Code for Data Processing using Python and SQL — 22%</li><li>Data Ingestion &amp; Acquisition -7%</li><li>Data Transformation, Cleansing, and Quality-10%</li><li>Data Sharing and Federation-5%</li><li>Monitoring and Alerting-10%</li><li>Cost &amp; Performance Optimisation -13%</li><li>Ensuring Data Security and Compliance -10%</li><li>Data Governance -7%</li><li>Debugging and Deploying -10%</li><li>Data Modelling-6%</li></ol><h3>What Actually Helped Me Clear the Exam</h3><p>Hands-on practice builds real confidence.<br>If you are new to Databricks, make sure you actually run code. Create Delta tables, try Auto Loader, use Delta Live Tables, and see how things behave instead of just reading about them.</p><p><strong><em>Understand the “why”.</em></strong><br>Whenever you learn something, ask yourself why it works that way. This exam heavily tests understanding, not memory.</p><p><strong><em>Read questions slowly.<br></em></strong>Many questions look simple but include a small detail that changes the answer completely.</p><p><strong><em>Use elimination.<br></em></strong> Even if you are unsure, removing incorrect options based on logic often leads you to the right answer.</p><p><strong>Real world experience helps a lot.</strong><br>I work with Databricks in my daily job, so that experience naturally helped. If you do not use Databricks regularly, hands-on practice becomes even more important.</p><h3>A Simple Exam Prep Checklist</h3><p>Before the exam, I made sure I could confidently answer questions related to Auto Loader schema evolution, Delta Live Tables expectations, merge and upsert patterns, streaming versus batch ingestion, and performance optimization scenarios.</p><p>I also made sure I could explain <em>why</em> one approach was better than another in real-world scenarios, not just which option was correct.</p><p>The exam consisted of 59 questions. I took a slow and careful approach, completed all questions in about one hour, and then used the remaining 30 minutes to review every answer. That final review helped me catch small mistakes and boosted my confidence before submitting.</p><h3>Final Thoughts</h3><p>The Databricks Professional Data Engineer exam is very manageable if you focus on concept clarity instead of memorization.</p><p>Practice tests are useful, but the real value comes from understanding why each option behaves the way it does. Once you build that mindset, the exam feels far less stressful and much more logical.</p><p>If you are preparing for this exam, focus on learning deeply, practice with intent, and trust your understanding. That approach worked for me, and it can work for you too.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c14d3f7fa7d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why MERGE Is Slower Than You Think, and How to Design Fast Upsert Pipelines in Delta Lake]]></title>
            <link>https://medium.com/@harsh11csb/why-merge-is-slower-than-you-think-and-how-to-design-fast-upsert-pipelines-in-delta-lake-979c45491e0c?source=rss-b7be42fe65fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/979c45491e0c</guid>
            <category><![CDATA[databricks]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[delta-lake]]></category>
            <category><![CDATA[merge]]></category>
            <dc:creator><![CDATA[Harsh Kumar]]></dc:creator>
            <pubDate>Tue, 06 Jan 2026 10:01:36 GMT</pubDate>
            <atom:updated>2026-01-06T10:01:36.699Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>MERGE</strong> is one of Delta Lake’s most celebrated features.<br>It enables upserts, CDC handling, and slowly changing dimensions using simple SQL.</p><p>But in real production systems, many teams hit the same wall:</p><blockquote><strong><em>MERGE works correctly -but it doesn’t scale the way people expect.</em></strong></blockquote><p>This article explains:</p><ol><li><strong>Why Merge is inherently expensive in Delta Lake</strong></li><li><strong>What actually happens under the hood</strong></li><li><strong>How to design fast upsert pipelines without overusing </strong><strong>MERGE</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ai68_T1Py1h2UHOcaA6eA.png" /></figure><h3>1️⃣ The Fundamental Misunderstanding</h3><p>Most performance issues with <strong><em>MERGE</em></strong>come from one assumption:</p><blockquote>“MERGE updates rows like a database.”</blockquote><p>Delta Lake is <strong>not a row-store database</strong>.</p><p>It is built on:</p><ul><li>Immutable Parquet files</li><li>Object storage</li><li>File-level operations</li></ul><p>Once you understand this, MERGE performance starts to make sense.</p><h3>2️⃣ Why Delta Lake Cannot Update Rows In-Place</h3><p>Delta Lake tables are composed of <strong>immutable Parquet files</strong>.</p><p>That means:</p><ul><li>Rows cannot be modified directly</li><li>Any update requires rewriting files</li><li>Even small changes can trigger large rewrites</li></ul><p>So when you run a MERGE, Delta Lake:</p><ul><li>Finds affected files</li><li>Reads them entirely</li><li>Writes new Parquet files</li><li>Marks old files as removed in the transaction log</li></ul><p>This is the <strong>core reason </strong><strong>MERGE is slow</strong>.</p><h3>3️⃣ What Actually Happens During a MERGE</h3><p>Behind the scenes, Delta Lake performs the following steps:</p><ol><li>Identify target files that <em>may</em> contain matching rows</li><li>Read those files completely</li><li>Join target data with source data</li><li>Apply update/insert logic</li><li>Write new Parquet files</li><li>Commit changes to _delta_log</li></ol><h3>4️⃣ Why Small MERGEs Are Often the Worst</h3><p>A common surprise in production:</p><blockquote><strong><em>A small MERGE can be slower than a large batch write.</em></strong></blockquote><p>Why?</p><ul><li>Metadata still needs to be scanned</li><li>Candidate files must be identified</li><li>Entire files get rewritten</li></ul><p>Frequent small MERGEs cause:</p><ul><li>File explosion</li><li>Transaction log growth</li><li>Increasing planning time</li><li>Gradual performance degradation</li></ul><h3>5️⃣ Skew and Partitioning Make MERGE Even More Expensive</h3><h3>Data Skew</h3><p>If a few keys map to many rows:</p><ul><li>Some tasks do most of the work</li><li>MERGE jobs develop long stragglers</li><li>Runtime increases unpredictably</li></ul><h3>Partitioning Pitfalls</h3><p>Partitioning only helps if:</p><ul><li>The MERGE condition includes partition columns</li><li>Source data aligns with partitions</li></ul><p>Incorrect partitioning can <strong>increase</strong> the number of rewritten files.</p><h3>6️⃣ The Right Question to Ask Before Using MERGE</h3><p>Before writing a MERGE, always ask:</p><blockquote><strong><em>Do I really need to update existing rows immediately?</em></strong></blockquote><p>If the answer is <strong>no</strong>, there is usually a faster and cheaper design.</p><h3>7️⃣ Fast Upsert Pattern #1: Append-Only + Dedup</h3><h3>Best for:</h3><ul><li>Event data</li><li>Fact tables</li><li>High-volume ingestion</li></ul><h3>How It Works</h3><ol><li>Always append incoming data</li><li>Deduplicate at read time or during downstream processing</li></ol><pre>SELECT *<br>FROM (<br>  SELECT *,<br>         ROW_NUMBER() OVER (PARTITION BY id ORDER BY updated_at DESC) rn<br>  FROM events<br>)<br>WHERE rn = 1;</pre><h3>Why It’s Fast</h3><ul><li>No file rewrites</li><li>Maximum write throughput</li><li>Simple failure recovery</li></ul><p>This pattern trades <strong>storage</strong> for <strong>speed</strong> — usually a good trade.</p><h3>8️⃣ Fast Upsert Pattern #2: Partition Overwrite</h3><h3>Best for:</h3><ul><li>Time-based data</li><li>Daily snapshots</li><li>Late-arriving records</li></ul><p>Instead of MERGE:</p><ul><li>Recompute affected partitions</li><li>Overwrite them completel</li></ul><pre>INSERT OVERWRITE TABLE target<br>PARTITION (dt = &#39;2025-01-01&#39;)<br>SELECT ...</pre><p>This limits rewrites to a known subset of data and delivers <strong>predictable performance</strong>.</p><h3>9️⃣ Fast Upsert Pattern #3: Controlled MERGE (When You Must)</h3><p>If MERGE is unavoidable:</p><ul><li>Batch updates instead of micro-updates</li><li>Filter source data aggressively</li><li>Include partition columns in join conditions</li></ul><pre>MERGE INTO target t<br>USING source s<br>ON t.id = s.id AND t.dt = s.dt</pre><p>Small design choices here can lead to <strong>order-of-magnitude improvements</strong>.</p><h3>🔟 Fast Upsert Pattern #4: Change Data Feed (CDF)</h3><p>Many pipelines use MERGE only to propagate changes downstream.</p><p>Delta Change Data Feed allows:</p><ul><li>Incremental change consumption</li><li>No unnecessary rewrites</li><li>Cleaner downstream pipelines</li></ul><p>Use MERGE less -<strong>read changes instead</strong>.</p><h3>Key Principle</h3><blockquote><strong><em>Push MERGE as late and as infrequent as possible.</em></strong></blockquote><h3>🧠 Final Thoughts</h3><p>MERGE is not slow because Delta Lake is inefficient.<br> It’s slow because Delta Lake prioritizes <strong>correctness, consistency, and reliability</strong>.</p><p>High-performing Delta Lake platforms are built by:</p><ul><li>Embracing immutability</li><li>Minimizing file rewrites</li><li>Choosing the right upsert pattern per use case</li></ul><p>That mindset is what separates:</p><blockquote>Delta users<em> from </em>Delta engineers<em>.</em></blockquote><h3>📌 Key Takeaways</h3><ul><li>MERGE rewrites files, not rows</li><li>Small, frequent MERGEs hurt performance</li><li>Append-only and partition overwrite are often faster</li><li>MERGE should be used intentionally, not by default</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=979c45491e0c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Parquet vs Delta Lake: What Actually Changes Under the Hood]]></title>
            <link>https://medium.com/@harsh11csb/parquet-vs-delta-lake-what-actually-changes-under-the-hood-ac48bac14ff9?source=rss-b7be42fe65fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac48bac14ff9</guid>
            <category><![CDATA[delta-lake]]></category>
            <category><![CDATA[parquet]]></category>
            <category><![CDATA[databricks]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Harsh Kumar]]></dc:creator>
            <pubDate>Tue, 30 Dec 2025 09:17:34 GMT</pubDate>
            <atom:updated>2025-12-30T09:17:34.730Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’ve spent time working with Spark or Databricks, you’ve probably heard this oversimplification:</p><blockquote>“Delta Lake is just Parquet with some metadata.”</blockquote><p>While this sounds technically correct, it completely misses the point.</p><p>Parquet is a <strong>file format</strong>.<br>Delta Lake is a <strong>transactional storage layer</strong>.</p><p>Delta Lake doesn’t replace Parquet-it <strong>solves the problems Parquet was never designed to handle</strong>.</p><p>This article explains <em>in detail</em> why Delta Lake is fundamentally different and why it is critical for reliable data engineering.</p><h3>1️⃣ What Parquet Was Designed For (and What It Wasn’t)</h3><p>Apache Parquet is:</p><ul><li>A <strong>columnar storage format</strong></li><li>Optimized for analytical queries</li><li>Efficient for scans, compression, and predicate pushdown</li></ul><p>Parquet excels at:</p><ul><li>Read-heavy workloads</li><li>Batch analytics</li><li>Immutable datasets</li></ul><p>However, Parquet <strong>does not provide</strong>:</p><ul><li>Transactions</li><li>Concurrency control</li><li>Table-level metadata</li><li>Versioning</li><li>Failure recovery</li></ul><p>Parquet stores <strong>files</strong>, not <strong>tables</strong>.</p><p>And production data platforms need <strong>tables with guarantees</strong>, not just files.</p><h3>2️⃣ Why Traditional Data Lakes Are Fragile</h3><p>A traditional data lake built only on Parquet looks like this:</p><pre>/events/<br>  ├── part-0001.parquet<br>  ├── part-0002.parquet<br>  ├── part-0003.parquet</pre><p>Now imagine real-world scenarios:</p><ul><li>A Spark job fails halfway through a write</li><li>Two pipelines write to the same dataset</li><li>Schema changes unexpectedly</li><li>Streaming jobs restart</li></ul><h3>❌ With Parquet Alone</h3><ul><li>Partial files remain</li><li>Table state is ambiguous</li><li>Readers may see corrupted data</li><li>Debugging is nearly impossible</li></ul><p>This is why teams say:</p><blockquote><em>“Our data lake works… until it doesn’t.”</em></blockquote><h3>3️⃣ Delta Lake Architecture: The Missing Layer</h3><p>Delta Lake introduces a <strong>transaction layer</strong> between Spark and Parquet.</p><h3>🔹 Delta Lake Architecture</h3><pre>Spark / Databricks<br>        |<br>        v<br>Delta Lake Transaction Layer(_delta_log)<br>        |<br>        v<br>Parquet Data Files(Object Storage)</pre><h3>Key Insight:</h3><blockquote><em>Delta Lake does not change how Parquet stores data.<br>It changes how Parquet files are </em><strong><em>written, tracked, and read</em></strong><em>.</em></blockquote><h3>4️⃣ The Delta Transaction Log (_delta_log) in Detail</h3><p>The _delta_log directory is the heart of Delta Lake.</p><p>It contains:</p><ul><li><strong>JSON commit files</strong> (one per transaction)</li><li><strong>Checkpoint files</strong> (Parquet snapshots of table state)</li></ul><p>Each transaction records:</p><ul><li>Files added</li><li>Files removed</li><li>Schema changes</li><li>Operation metadata</li><li>Table version</li></ul><h3>Write Process (Simplified)</h3><ol><li>Spark writes new Parquet files</li><li>A new commit is prepared in _delta_log</li><li>Commit is atomically applied</li><li>Readers see either <strong>old or new state</strong>, never partial</li></ol><p>This enables:</p><ul><li>Atomic writes</li><li>Consistent reads</li><li>Safe concurrent operations</li></ul><h3>5️⃣ Why Updates, Deletes &amp; MERGE Are Possible</h3><p>With Parquet:</p><ul><li>Files are immutable</li><li>Updates require rewriting everything</li></ul><p>Delta Lake solves this by:</p><ul><li>Writing new Parquet files</li><li>Marking old files as removed in _delta_log</li></ul><p>This enables:</p><pre>MERGE INTO target t<br>USING source s<br>ON t.id = s.id<br>WHEN MATCHED THEN UPDATE<br>WHEN NOT MATCHED THEN INSERT</pre><p>Delta handles this <strong>safely and transactionally</strong>, even at scale.</p><h3>6️⃣ Schema Enforcement &amp; Evolution (Data Quality Control)</h3><p>One of the biggest production pain points is <strong>schema drift</strong>.</p><h3>Parquet Behavior</h3><ul><li>Accepts any schema</li><li>Silent failures</li><li>Downstream jobs break later</li></ul><h3>Delta Lake Behavior</h3><ul><li><strong>Schema enforcement</strong> blocks incompatible writes</li><li><strong>Schema evolution</strong> allows controlled changes</li></ul><p>This turns the data lake from:</p><blockquote><em>“Best-effort storage”<br>into<br>“Reliable analytical foundation”</em></blockquote><h3>7️⃣ Time Travel &amp; Versioning (Underrated Superpower)</h3><p>Delta Lake stores every table version.</p><p>You can:</p><pre>SELECT * FROM table VERSION AS OF 42;</pre><p>Use cases:</p><ul><li>Debugging broken pipelines</li><li>Auditing data changes</li><li>Rolling back bad deployments</li><li>Reproducing historical reports</li></ul><p>Without Delta, this level of observability simply doesn’t exist.</p><h3>8️⃣ Performance Is About Metadata, Not Just Files</h3><p>Delta Lake enables:</p><ol><li><strong><em>Efficient file pruning</em></strong>: Delta Lake tracks which files belong to a table version using its transaction log. Spark reads only the relevant files instead of scanning the entire dataset.</li><li><strong><em>Data skipping using statistics</em></strong>: Delta stores min/max statistics for columns at the file level. Queries skip files that cannot satisfy filter conditions, reducing I/O.</li><li><strong><em>Compaction of small files</em></strong>: Frequent writes create many small files that slow down queries. Delta compacts them into larger files using OPTIMIZE, improving performance.</li><li><strong><em>Z-Ordering for multi-dimensional filters</em></strong>: Z-Ordering co-locates related data across multiple columns. This significantly improves query performance for multi-column filter queries.</li></ol><p>The transaction log allows Spark to:</p><blockquote><em>Read </em><strong><em>only what is needed</em></strong><em>, not everything available.</em></blockquote><p>This drastically improves performance on large datasets.</p><h3>9️⃣ Streaming Reliability (Exactly-Once Semantics)</h3><p>Delta Lake integrates deeply with Structured Streaming:</p><ul><li>Checkpoints + transaction log</li><li>Idempotent writes</li><li>Safe recovery after failures</li></ul><p>Streaming pipelines become:</p><ul><li>Easier to reason about</li><li>Safer to operate</li><li>Truly production-ready</li></ul><h3>🔟 Why Delta Lake Is Essential for Production Systems</h3><p>If your platform has:</p><ul><li>Incremental loads</li><li>Multiple pipelines</li><li>Streaming ingestion</li><li>Business-critical tables</li></ul><p>Then Parquet alone is a <strong>liability</strong>.</p><p>Delta Lake provides:</p><ul><li>Reliability</li><li>Correctness</li><li>Observability</li><li>Maintainability</li></ul><h3>🧠 Final Verdict</h3><p><strong>Parquet is storage.<br>Delta Lake is state management.</strong></p><p>Delta Lake doesn’t compete with Parquet.<br>It <strong>unlocks Parquet’s full potential</strong>.</p><p>If Parquet is the bricks,<br>Delta Lake is the <strong>engineering discipline that prevents the building from collapsing</strong>.</p><h3>🔜 Coming Next</h3><p><strong>Managed vs External Tables in Databricks -What Actually Matters</strong></p><p>If you found this useful, follow for more <strong>Databricks internals explained clearly</strong> 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac48bac14ff9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Practical Guide to Cluster Sizing, Spark Execution, and Performance Tuning]]></title>
            <link>https://medium.com/@harsh11csb/a-practical-guide-to-cluster-sizing-spark-execution-and-performance-tuning-6ed82b6001bb?source=rss-b7be42fe65fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ed82b6001bb</guid>
            <category><![CDATA[spark-executor]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[spark-optimization]]></category>
            <category><![CDATA[clustering]]></category>
            <dc:creator><![CDATA[Harsh Kumar]]></dc:creator>
            <pubDate>Wed, 03 Dec 2025 08:42:23 GMT</pubDate>
            <atom:updated>2025-12-03T08:42:23.987Z</atom:updated>
            <content:encoded><![CDATA[<h3>From 6GB Raw Data to Optimized Silver Tables: A Practical Guide to Cluster Sizing, Spark Execution, and Performance Tuning</h3><p>When you’re working with multi‑gigabyte datasets on Databricks, you quickly realize that performance is shaped not just by the code you write, but by the cluster you run it on, how Spark plans your job, and how much memory your transformations require. Let’s walk through a real, end‑to‑end scenario: processing a <strong>6GB source file</strong> through <strong>Bronze → Silver</strong>, using a cluster with <strong>r5d.large driver</strong> and <strong>m5d.xlarge workers</strong>.</p><h3>Bronze and Silver Layers</h3><pre>Raw Source (6GB)<br>        |<br>        v<br>   +-----------+<br>   |  Bronze   |<br>   |  Raw Data |<br>   +-----------+<br>        |<br>  Clean, Normalize,<br>   Deduplicate<br>        |<br>        v<br>   +-----------+<br>   |  Silver   |<br>   |Curated Data|<br>   +-----------+<br>        |<br>    Joins, Logic,<br>  Business Rules<br>        |<br>        v<br>   +-------------+<br>   |  Gold/BI    |<br>   | Aggregated  |<br>   +-------------+</pre><p><strong>Bronze</strong> stores raw, ingested data exactly as received, keeping the original structure for audit and replay.<br> <strong>Silver</strong> applies cleaning, normalization, deduplication, and joins to create reliable, analytics-ready datasets.</p><h3>1. Understanding the Raw Input: 6GB File Size</h3><p>Assume a 6GB file on S3 or ADLS rarely ends up as 6GB in memory.</p><ul><li>Spark decompresses, deserializes, and expands data.</li><li>Dataframes typically grow <strong>3–10×</strong> larger in memory.</li><li>If there are lets say 500 columns and 1M+ rows, it’s normal to see the dataframe expand to <strong>30–60GB</strong> in memory.</li></ul><p>This is why shuffle, caching, and wide transformations matter.</p><h3>2. Cluster Setup and What It Means</h3><p>Lets say the job runs on aws cluster with below config:</p><ul><li><strong>Driver:</strong> r5d.large (2 vCPU, 16GB)</li><li><strong>Workers:</strong> m5d.xlarge (4 vCPU, 16GB) × auto‑scale 2- 4</li><li><strong>Runtime:</strong> DBR 16.4 LTS (Spark 3.5.2)</li></ul><p>Total worker memory (at 4 nodes): ~64GB<br> Spark allocates ~75% of that to executors → <strong>~48GB actual executor memory</strong>.</p><p>That memory needs to support:</p><ul><li>Input expansion</li><li>Transformations</li><li>Shuffle</li><li>Joins, sorts, aggregations</li><li>Delta writes</li></ul><h3>3. Bronze → Silver: How Spark Forms Jobs and Stages</h3><h3>How Spark splits your workload:</h3><ul><li><strong>Each action</strong> (write, display, count) = <strong>a separate job</strong>.</li><li>Each job is split into <strong>stages</strong> based on shuffle boundaries.</li><li>Each stage contains many <strong>tasks</strong>, one per partition.</li></ul><h3>Example Bronze → Silver flow:</h3><ol><li>Read 6GB CSV/JSON/Parquet → Job 1</li><li>Apply transformations (select, withColumn, filter) → same job</li><li>Join + aggregation → triggers shuffle → stage split</li><li>Write to Bronze → action → end of Job 1</li></ol><p>Then Silver:</p><ol><li>Read Bronze Delta → Job 2</li><li>Apply business logic, normalization → narrow transformations</li><li>Join reference/master tables → wide transformation → shuffle</li><li>Write to Silver Delta → ends job</li></ol><p>Typical pipeline: <strong>3–6 jobs</strong>, <strong>10–40 stages</strong>, depending on joins and partitions.</p><h3>4. Does the Number of Partitions Change the Number of Stages?</h3><p>Not directly.</p><ul><li>More partitions → <strong>more tasks per stage</strong>, but <strong>same number of stages</strong>.</li><li>New stage only appears when:</li><li>A shuffle happens</li><li>A wide transformation occurs (groupBy, join, orderBy)</li><li>Data is written</li></ul><p>Partition count affects runtime, not structure.</p><h3>5. What Happens if Shuffle Needs More Than Available Memory?</h3><p>Shuffle files spill to <strong>disk</strong>, not memory.</p><ul><li>Spark writes temporary data to SSDs on m5d.xlarge workers.</li><li>Up to a point, spilling is expected.</li><li>If shuffle exceeds disk temp space or executor memory repeatedly → <strong>task fails</strong>.</li></ul><h3>Will the job fail if shuffle needs 80GB and you have 48GB executor memory?</h3><p>Not immediately.<br> Spark will:</p><ol><li>Spill to disk</li><li>Compress shuffle data</li><li>Recompute tasks if needed</li></ol><p>Job fails only if:</p><ul><li>Disk runs out</li><li>Executor OOMs</li><li>Too many retries hit Spark’s retry limit</li></ul><h3>6. How to Ensure Stable Silver Pipeline Performance</h3><h3>Key tuning steps:</h3><ul><li>Repartition by high‑cardinality keys before join.</li><li>Avoid orderBy unless required.</li><li>Cache only when reused multiple times.</li><li>Use broadcast joins for small tables.</li><li>Use OPTIMIZE and ZORDER on Silver.</li></ul><h3>Cluster tuning:</h3><ul><li>Increase worker memory, not CPUs, for wide shuffles.</li><li>Prefer r5/m5 series for compute jobs.</li><li>Enable autoscaling to handle peak shuffle loads.</li></ul><h3>9. Final Thoughts</h3><p>Moving a 6GB file through Bronze → Silver is not about the input size; it’s about the expanded, transformed, and shuffled size. Spark uses memory aggressively and spills to disk when required. The cluster you choose directly impacts reliability and speed. With the right sizing, partitioning, and pipeline design, even complex, wide tables (500 columns) run smoothly.</p><p>This practical understanding is what separates a smooth ETL pipeline from one that constantly breaks under shuffle pressure.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ed82b6001bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Free Tools That’ll Level Up Your Data Engineering Skill]]></title>
            <link>https://medium.com/@harsh11csb/free-tools-thatll-level-up-your-data-engineering-skill-d4136a4d27e3?source=rss-b7be42fe65fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4136a4d27e3</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[resources]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Harsh Kumar]]></dc:creator>
            <pubDate>Thu, 30 Oct 2025 08:25:33 GMT</pubDate>
            <atom:updated>2025-10-30T08:25:33.205Z</atom:updated>
            <content:encoded><![CDATA[<p>When you’re starting out in any field , or even if you’ve been around for a while , staying updated is what really keeps you sharp. In tech, that means keeping up with tools, frameworks, and how the ecosystem keeps shifting.</p><p>So let’s talk about a few websites you can explore to <strong>learn, practice, and stay curious</strong> as a data engineer (or someone aspiring to be one).</p><p>These platforms aren’t just for brushing up skills , they’re for building habits. Spend even <strong>10–15 minutes a day</strong>, try something new, and you’ll be surprised how much it compounds. There’s truth to that old idea: getting <strong>1% better every day</strong> adds up to massive growth over time. Think of it as a <strong>long-term investment in your career</strong>.</p><h3>🧩 1. Data Engineering Zoomcamp (DataTalks.Club)</h3><p><strong>URL:</strong> <a href="https://github.com/DataTalksClub/data-engineering-zoomcamp">https://github.com/DataTalksClub/data-engineering-zoomcamp</a><br>The best free end-to-end course. You’ll build data pipelines using <strong>Docker, Airflow, BigQuery, dbt, Terraform, and Spark</strong>.<br>Includes real assignments and datasets, this one alone can make your resume stand out.</p><h3>🧮 2. StrataScratch (Free Tier)</h3><p><strong>URL:</strong> <a href="https://www.stratascratch.com/">https://www.stratascratch.com/</a><br>Has hundreds of <strong>SQL and Python questions</strong> from real companies.<br>You can solve, run, and validate answers right in the browser.<br>Excellent for building query intuition.</p><h3>💾 3. Kaggle</h3><p><strong>URL:</strong> <a href="https://www.kaggle.com/">https://www.kaggle.com/</a><br>Completely free, gives you a hosted Jupyter notebook with compute power.<br>Practice data cleaning, transformation, and analysis on <strong>public datasets</strong> using Python or SQL (via duckdb or sqlite).</p><h3>🧱 4. SQLZoo</h3><p><strong>URL:</strong> <a href="https://sqlzoo.net/">https://sqlzoo.net/</a><br> Fast, interactive SQL challenges with immediate feedback.<br> Good for quick practice on basics and joins.</p><h3>🕵️‍♂️ 5. SQL Murder Mystery (Knight Lab)</h3><p><strong>URL:</strong> <a href="https://mystery.knightlab.com/">https://mystery.knightlab.com/</a><br> A story-based SQL game where you solve a murder mystery by writing queries.<br> Perfect for <strong>freshers</strong> learning how to think analytically and use SQL creatively.</p><h3>📂 6. Data.gov (Public Datasets)</h3><p><strong>URL:</strong> <a href="https://www.data.gov/">https://www.data.gov/</a>**<br> Massive collection of real, open government datasets.<br> Perfect for creating your own <strong>ETL or data cleaning projects</strong>, testing pipelines, or practicing on realistic data at scale.</p><h3>🎬 7. Netflix Tech Blog</h3><p><strong>URL:</strong> <a href="https://netflixtechblog.com/**">https://netflixtechblog.com/</a><br> Deep dives into how Netflix engineers handle <strong>data pipelines, experimentation, and distributed systems</strong>.<br> A must-read for understanding <strong>real-world architecture, scaling, and reliability</strong> in massive data ecosystems.</p><h3>🧩 Conclusion</h3><p>If you’re serious about data engineering, whether you’re just starting out or already in the field, these free resources are all you really need to learn, practice, and build real projects.</p><p>You don’t need a paid bootcamp to get good. Between open datasets, SQL challenges, and community-driven projects, you can learn almost everything that working data engineers use daily, for free.</p><p>Start small, stay consistent, and build something real every few weeks. That’s what will separate you from the crowd.</p><p>If you know any other <strong>free and genuinely useful</strong> sites or practice platforms that helped you<br> 👉 <strong>drop them in the comments</strong> so others can benefit too.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4136a4d27e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>