<?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 Shyamalagowri on Medium]]></title>
        <description><![CDATA[Stories by Shyamalagowri on Medium]]></description>
        <link>https://medium.com/@shyamalaagowri?source=rss-d89df19d41f2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*fofS8TsPoliHrS4e</url>
            <title>Stories by Shyamalagowri on Medium</title>
            <link>https://medium.com/@shyamalaagowri?source=rss-d89df19d41f2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 06:34:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shyamalaagowri/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[Write-Optimized to Query-Optimized: MoR to CoW Table Conversion with Spark in watsonx.data]]></title>
            <link>https://medium.com/@shyamalaagowri/write-optimized-to-query-optimized-mor-to-cow-table-conversion-with-spark-in-watsonx-data-65acb73ce952?source=rss-d89df19d41f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/65acb73ce952</guid>
            <dc:creator><![CDATA[Shyamalagowri]]></dc:creator>
            <pubDate>Mon, 08 Dec 2025 08:48:53 GMT</pubDate>
            <atom:updated>2025-12-08T10:32:46.366Z</atom:updated>
            <content:encoded><![CDATA[<p>Handling massive volumes of streaming data is a common challenge in modern data platforms. You need to ingest data quickly, update it efficiently, and retrieve it at high speed when analytics or dashboards request it.</p><p><strong>Watsonx.data Spark</strong> offers a powerful solution — combining fast ingestion with long-term query optimization using Apache Iceberg table formats.</p><p>This article breaks down how Merge-on-Read (MoR) and Copy-on-Write (CoW) work, why they matter, and how Watsonx.data Spark can be used to automate the pipeline.</p><h3>Why Iceberg Matters for Modern Data Lakes</h3><p>Apache Iceberg brings database-like capabilities to cloud storage, enabling scalable and reliable lakehouse architectures.</p><p><strong>Key Iceberg Features:</strong></p><ul><li><strong>ACID transactions</strong> ensure consistent writes, even with concurrency</li><li><strong>Schema evolution</strong> supports safe and trackable schema changes</li><li><strong>Partition evolution</strong> allows flexibility as data patterns shift</li><li><strong>Open standards</strong> ensure compatibility across engines and clouds</li></ul><p>These capabilities make Iceberg ideal for high-volume streaming pipelines — but writing efficiently matters just as much as reading efficiently.</p><h3>MoR vs. CoW: Choosing the Right Write Strategy</h3><p>Iceberg supports two primary write patterns. Choosing the correct one dramatically impacts ingestion speed and query performance.</p><h3>Copy-on-Write (CoW)</h3><p>CoW rewrites entire data files whenever updates or deletes occur.</p><ul><li>High I/O for frequent updates</li><li>Ideal for <strong>fast reads</strong>, not writes</li><li>Best suited for <strong>query-heavy workloads</strong></li></ul><h3>Merge-on-Read (MoR)</h3><p>MoR writes only incremental changes, such as delete files or new data fragments.</p><ul><li>Avoids heavy file rewrites</li><li>Much faster ingestion</li><li>Reduces write amplification</li></ul><p>However, MoR can generate many small files over time, which can slow down queries — unless compaction is applied.</p><h3>The Solution: Asynchronous Compaction</h3><p>Watsonx.data Spark jobs can be scheduled to periodically compact MoR data into efficient CoW tables. This means:</p><ul><li><strong>Fast writes</strong> during ingestion</li><li><strong>Fast reads</strong> for analytics</li><li>Separation of ingestion and consumption concerns</li></ul><h3>How Real-Time Log Ingestion Works with Watsonx.data Spark</h3><p>Let’s walk through a real-world example: ingesting and analyzing continuous server logs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NPXmXYvAD0Pv0pfkbSRV6Q.png" /></figure><h3>Pipeline Overview</h3><ul><li><strong>Log Generators</strong><br>Applications, servers, and devices emit log events continuously.</li><li><strong>Kafka</strong><br>Provides durable, scalable buffering of log events.</li><li><strong>Spark Structured Streaming</strong><br>Reads log data from Kafka, parses raw logs, and writes as Iceberg MoR (Merge-on-Read) tables in watsonx.data. Note: By default, Spark creates CoW (Copy-on-Write) tables unless explicitly specified to create MoR tables.</li><li><strong>Data Lake (MoR Tables)</strong><br>Stores constantly updated log data as MoR tables for efficient write operations.</li><li><strong>Scheduled Spark Jobs</strong><br>Regularly compact MoR → CoW for optimized querying. Spark jobs can be scheduled to run periodically using watsonx platform jobs, automating the compaction process. For details, see <a href="https://www.ibm.com/docs/en/watsonxdata/premium/2.2.x?topic=data-analyze-process-spark">Scheduling Spark Jobs in watsonx.data</a></li><li><strong>Downstream Consumers</strong><br>Analysts, BI tools, and ML models query from the optimized CoW tables for better read performance.</li></ul><h3>Why Use MoR for Ingestion and CoW for Consumption?</h3><p>A two-stage table strategy gives the best of both worlds:</p><h3>MoR for Ingestion</h3><ul><li>High write throughput</li><li>Ideal for streaming and update-heavy workloads</li></ul><h3>CoW for Consumption</h3><ul><li>Highly optimized for analytical queries</li><li>Reduces latency for dashboards and BI tools</li></ul><p>Watsonx.data automates the conversion from MoR to CoW through scheduled Spark compaction jobs.</p><h3>How Scheduled Spark Jobs Optimize Your Tables</h3><p>Scheduled jobs run regularly — hourly, nightly, or based on your pipeline needs — to keep data fresh and optimized.</p><p>These jobs:</p><ul><li>Read the MoR table</li><li>Identify only the new delta changes</li><li>Compact and merge them</li><li>Write the fully optimized data into a CoW table</li><li>Ensure downstream tools always read from a fast, query-optimized dataset</li></ul><p>This architecture keeps ingestion smooth and user queries blazing fast.</p><h3>Sample Payload: MoR → CoW Conversion Job</h3><p>Here is a Watsonx.data Spark job configuration for converting a MoR table into a CoW table:</p><pre>{<br>  &quot;application_details&quot;: {<br>    &quot;application&quot;: &quot;/opt/ibm/spark/builtin-apps/iceberg/iceberg-apps.jar&quot;,<br>    &quot;class&quot;: &quot;com.ibm.iceberg.apps.RegisterCowTable&quot;,<br>    &quot;arguments&quot;: [<br>      &quot;--catalog&quot;, &quot;&lt;catalog-name&gt;&quot;,<br>      &quot;--database&quot;, &quot;&lt;database-name&gt;&quot;,<br>      &quot;--mor-table&quot;, &quot;&lt;mor-table-name&gt;&quot;,<br>      &quot;--cow-table&quot;, &quot;&lt;cow-table-name&gt;&quot;<br>    ],<br>    &quot;conf&quot;: {<br>      &quot;spark.hadoop.wxd.apikey&quot;: &quot;Basic &lt;encoded-api-key&gt;&quot;<br>    }<br>  }<br>}</pre><p><strong>Parameters</strong></p><ul><li><strong>&lt;catalog-name&gt;</strong> – Iceberg catalog</li><li><strong>&lt;database-name&gt;</strong> – Database containing the MoR table</li><li><strong>&lt;mor-table-name&gt;</strong> – MoR data source</li><li><strong>&lt;cow-table-name&gt;</strong> – CoW output table</li><li><strong>&lt;encoded-api-key&gt;</strong> – Base64-encoded IBM Cloud API key</li></ul><p>This job ensures your CoW table stays synchronized and optimized.</p><h3>Scheduling spark jobs in watsonx.data</h3><p>Spark jobs can be scheduled to run periodically using watsonx platform jobs, enabling automated data processing workflows. This feature allows you to:</p><ul><li>Define schedules using cron expressions or time intervals</li><li>Configure Spark job parameters and resource allocations</li><li>Monitor execution through the watsonx console</li><li>Set up automatic retries and failure notifications</li></ul><p>For detailed setup instructions and configuration examples, see the <a href="https://www.ibm.com/docs/en/watsonxdata">official documentation</a>.</p><h3>Benefits for Analytics &amp; Machine Learning</h3><p>With optimized CoW tables, consumers get:</p><ul><li>Faster dashboard queries</li><li>Better performance for ad-hoc troubleshooting</li><li>More efficient ML model training</li><li>A consistent, up-to-date view of log data</li></ul><p>Analysts and data scientists can focus on insights — not data engineering complexity.</p><h3>Additional Resources</h3><ul><li><a href="https://cloud.ibm.com/docs/watsonxdata?topic=watsonxdata-smbit_nsp_1">Submitting Spark Applications with watsonx.data</a></li><li><a href="https://cloud.ibm.com/docs/watsonxdata?topic=watsonxdata-run-spark-streaming-applications">Spark Streaming Applications</a></li><li><a href="https://www.ibm.com/docs/en/watsonxdata/standard/2.2.x?topic=engine-submitting-spark-jobs-mor-cow-conversion">MoR to CoW Table Conversion</a></li><li><a href="https://medium.com/selectfrom/streaming-applications-on-serverless-spark-66f282a29b7c">Streaming Applications on Serverless Spark</a></li><li><a href="https://www.ibm.com/docs/en/watsonxdata/premium/2.2.x?topic=data-analyze-process-spark">Scheduling spark jobs in watsonx.data</a></li></ul><h3>Conclusion</h3><p>watsonx.data Spark, combined with Iceberg’s MoR and CoW formats, provides an elegantly balanced architecture for streaming workloads:</p><ul><li><strong>MoR delivers fast, efficient ingestion</strong></li><li><strong>CoW delivers fast, optimized queries</strong></li><li><strong>Scheduled Spark jobs automate compaction and synchronization</strong></li></ul><p>This architecture is ideal for high-volume, real-time pipelines such as log ingestion, observability systems, and event-driven analytics.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65acb73ce952" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Accessing ADLS Storage with DAS in the Native Spark Engine on WatsonX.Data]]></title>
            <link>https://medium.com/@shyamalaagowri/accessing-adls-storage-with-das-in-the-native-spark-engine-on-watsonx-data-75d3cfb8fba7?source=rss-d89df19d41f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/75d3cfb8fba7</guid>
            <category><![CDATA[adl]]></category>
            <category><![CDATA[da]]></category>
            <category><![CDATA[watsonxdata]]></category>
            <category><![CDATA[spark]]></category>
            <category><![CDATA[cpd]]></category>
            <dc:creator><![CDATA[Shyamalagowri]]></dc:creator>
            <pubDate>Mon, 23 Sep 2024 12:47:21 GMT</pubDate>
            <atom:updated>2024-09-26T13:30:52.851Z</atom:updated>
            <content:encoded><![CDATA[<h3>Accessing ADLS Storage with DAS in Spark Engine on IBM watsonx.data , Cloud Pak for Data (CPD)</h3><p>This Story has been co-authored with <a href="https://medium.com/u/db0aa0753448">Aarush Singh</a></p><p><strong>What is ADLS</strong> : <strong>Azure Data Lake Storage (ADLS)</strong> is a cloud-based storage solution by Microsoft designed to handle massive amounts of data for big data analytics. In this post, we would look at GEN1 and GEN2 modes to access data in Azure storage.<br><strong>Azure Data Lake Storage Gen1 (ADLS Gen1)</strong> : first generation of the data lake solution offered by Azure designed to handle large-scale data analytics workloads. It is highly scalable, capable of managing petabytes of data, and offers robust security features such as access control and encryption. ADLS Gen1 is based on Hadoop Distributed File System (HDFS) and it has a flat namespace. ADLS Gen1 uses access control lists (ACLs) for authorization.</p><p><strong>Azure Data Lake Storage Gen2 (ADLS Gen2): </strong>It is the evolution of Gen1, combining the capabilities of Azure Blob Storage with the features of ADLS Gen1. This integration results in a highly scalable and performant data lake solution that offers enhanced security, advanced features, and cost-efficiency. ADLS Gen2 maintains the scalability of its predecessor while significantly improving performance through a hierarchical namespace, which allows for faster data access and better file management. It also provides advanced security features, including fine-grained access control and comprehensive encryption options.</p><p><strong>IBM’s watsonx.data is part of the IBM watsonx suite</strong>, which is a comprehensive set of AI and data services designed to help organizations harness the power of AI and big data. IBM watsonx.data is specifically focused on data management and analytics. It provides tools and capabilities to manage, govern, and analyze data at scale, enabling businesses to derive insights from their data more effectively.</p><p>We will start with creating/using wxd instance, spark engine and then adding ADLS storage to read/write data through a spark job.</p><h3>1. Creating spark engine</h3><p>In the cpd console, navigate to IBM watsonx.data instance (lakehouse instance is the default IBM watsonx.data instance)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HN6vhjtHsvx1LJqETRkDkQ.png" /></figure><p>Locate the instance with name <strong>lakehouse</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JK_fU11V8sBgoLfe2k03ig.png" /></figure><p>Open the instance and it will take you to the Infrastructure page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qMC1vF8uxte5FORNfIJfag.png" /></figure><p>Create a new native spark engine and add new volume to the spark instance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*01jcqYe6dW7zACQMUeOdpQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jggKgIINLW7CyDsIBm0lkg.png" /></figure><h3>2. Add ADLS storage, catalog and associate it with spark engine</h3><p>Now after Spark-engine is created, Add Component of storage(Azure Data Lake Storage)</p><p>You can choose to add Gen2(ADLS Gen2) or Gen1(Azure Blob)</p><p>Adding Gen1 storage with Account Key credential</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4FHJRGMHykNvL6cAM3ejjA.png" /></figure><p>Adding Gen2 storage with service principal credentials</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iuLN5rnDAQlVjSpqEyziVA.png" /></figure><p>Note: You can associate a catalog here, with catalog association ADLS config details are added to the spark config by default. In this case, you will not be required to pass the storage authentication details in the spark config during job execution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GxkvDoBWbM9CJR3Jfk3yGg.png" /></figure><p>DAS is enabled by default and hence the DAS specific configuration details required to connect to the storage are added to spark config. In the below screenshot, we can see spark config to be updated with DAS (Data Access Service) credentials updated to connect to the ADLS storage container.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P5GQkBj_Dxdxynl0w6aJDA.png" /></figure><h3>3. Submit Spark Application against the native engine</h3><p>Payload which can be used for running the spark job using ADLS Gen2. Copy the contents of this file to sparkappcasg2.py Note: we are not passing any ADLS credentials that are required to access the storage.</p><pre>from pyspark.sql import SparkSession<br>from datetime import datetime<br>def init_spark(schema, account_name):<br>    spark = SparkSession.builder \<br>        .appName(&quot;ADLS pyspark job&quot;) \<br>        .config(&quot;spark.hadoop.wxd.apikey&quot;, &quot;ZenApiKey ***&quot;) \<br>        .config(f&quot;spark.sql.catalog.{schema}&quot;, &quot;org.apache.iceberg.spark.SparkCatalog&quot;) \<br>        .config(f&quot;spark.sql.catalog.{schema}.type&quot;, &quot;hive&quot;) \<br>        .config(&quot;spark.hive.metastore.client.plain.username&quot;, &quot;cpadmin&quot;) \<br>        .config(&quot;spark.hive.metastore.client.plain.password&quot;, &quot;*****&quot;) \<br>        .config(&quot;fs.azure.createRemoteFileSystemDuringInitialization&quot;, &quot;true&quot;) \<br>        .enableHiveSupport() \<br>        .getOrCreate()<br>    return spark<br>def create_database(spark, account_name, container_name, schema, database_name):<br>    spark.sql(f&quot;CREATE DATABASE {schema}.{database_name} LOCATION &#39;abfss://{container_name}@{account_name}.dfs.core.windows.net/{database_name}&#39;&quot;)<br>def create_table(spark, schema, database_name, tablename):<br>    spark.sql(f&quot;CREATE TABLE IF NOT EXISTS {schema}.{database_name}.{tablename}(id INTEGER, name VARCHAR(10), age INTEGER, salary DECIMAL(10, 2)) USING iceberg&quot;)<br>def list_tables(spark, schema, database_name):<br>    spark.sql(f&quot;SHOW TABLES FROM {schema}.{database_name}&quot;).show()<br>def insert_data(spark, schema, database_name, table):<br>    spark.sql(f&quot;INSERT INTO {schema}.{database_name}.{table} VALUES (1, &#39;aa&#39;, 18, 12000)&quot;)<br>def view_data(spark, schema, database_name, table):<br>    sqlDF = spark.sql(f&quot;SELECT * FROM {schema}.{database_name}.{table}&quot;)<br>    sqlDF.show()<br>def clean_database(spark, schema, database_name, table):<br>    spark.sql(f&quot;DROP TABLE IF EXISTS {schema}.{database_name}.{table} PURGE&quot;)<br>    spark.sql(f&quot;DROP DATABASE IF EXISTS {schema}.{database_name} CASCADE&quot;)<br>    print(&quot;\n&quot;)<br>def show_databases(spark, schema):<br>    spark.sql(f&quot;SHOW DATABASES FROM {schema}&quot;).show()<br>def main():<br>    try:<br>        account_name = &quot;sparkadlsiae&quot;<br>        container_name = &quot;pyspark&quot;<br>        schema_name = &quot;adls_casspark&quot;<br>        db_name = &quot;adls_cassparkdb&quot;<br>        table_name = &quot;adls_cassparktb&quot;<br>        spark = init_spark(schema_name, account_name)<br>        spark.sparkContext.setLogLevel(&quot;INFO&quot;)<br>        print(&quot;======Showing Database In Beginning=========&quot;)<br>        show_databases(spark, schema_name)<br>        print(&quot;===Done: Showing Database In Beginning====&quot;)<br>        print(&quot;\n&quot;)<br>        print(&quot;======Creating Database=========&quot;)<br>        create_database(spark, account_name, container_name, schema_name, db_name)<br>        print(&quot;===Done: Creating Database====&quot;)<br>        print(&quot;\n&quot;)<br>        print(&quot;======Showing Database After Creation=========&quot;)<br>        show_databases(spark, schema_name)<br>        print(&quot;===Done: Showing Database After Creation====&quot;)<br>        print(&quot;\n&quot;)<br>        print(&quot;======Creating Table=========&quot;)<br>        create_table(spark, schema_name, db_name, table_name)<br>        print(&quot;===Done: Table Creation===&quot;)<br>        print(&quot;\n&quot;)<br>        print(&quot;======List Table=========&quot;)<br>        list_tables(spark, schema_name, db_name)<br>        print(&quot;====Done: List Table====&quot;)<br>        print(&quot;\n&quot;)<br>        print(&quot;=======Inserting Data========= &quot;)<br>        insert_data(spark, schema_name, db_name, table_name)<br>        print(&quot;===Done: Inserting Data====&quot;)<br>        print(&quot;\n&quot;)<br>        print(&quot;=======Querying Data========== &quot;)<br>        view_data(spark, schema_name, db_name, table_name)<br>        print(&quot;===Done: Querying Data===&quot;)<br>        print(&quot;\n&quot;)<br>        print(&quot;======Cleaning Database=========&quot;)<br>        clean_database(spark, schema_name, db_name, table_name)<br>        print(&quot;====Done: Cleaning Database====&quot;)<br>        print(&quot;\n&quot;)<br>        print(&quot;======Showing Database After Cleanup=========&quot;)<br>        show_databases(spark, schema_name)<br>        print(&quot;===Done: Showing Database After Cleanup====&quot;)<br>        print(&quot;\n&quot;)<br>    except Exception as e:<br>        print(f&quot;An error occurred: {e}&quot;)<br>    finally:<br>        spark.sparkContext.stop()<br>        spark.stop()<br>if __name__ == &#39;__main__&#39;:<br>    main()</pre><p>Create a volume and add this application code in the volume.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*smwlVrm59iNTG4cwKbdzPg.png" /></figure><p>Add application file sparkappcasg2.py to the volume.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tqpQudeLMVeUnLs4IFbtGw.png" /></figure><p>The below code can be used to execute a spark application that executes the application code sparkappcasg2.py stored in the volume</p><pre>import requests<br>import json<br>import urllib3<br>urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)<br>wxd_instance_id=1725938820505705<br>url = &quot;https://cpd-cpd-instance.apps.adls-demo.cp.fyre.ibm.com/lakehouse/api/v2/spark_engines/spark134/applications&quot;<br>wxd_token=&quot;ZenApiKey ***********&quot;<br>payload = json.dumps({<br>  &quot;application_details&quot;: {<br>    &quot;application&quot;: &quot;/spark-vol/sparkappcasg2.py&quot;<br>  },<br>  &quot;volumes&quot;: [<br>    {<br>      &quot;name&quot;: &quot;cpd-instance::app-volume&quot;,<br>      &quot;mount_path&quot;: &quot;/spark-vol/&quot;,<br>      &quot;source_sub_path&quot;: &quot;&quot;<br>    }<br>  ]<br>})<br>headers = {<br>  &#39;Authorization&#39;: str(wxd_token),<br>  &#39;Content-Type&#39;: &#39;application/json&#39;,<br>  &#39;LhInstanceId&#39;: str(wxd_instance_id),<br>}<br>response = requests.request(&quot;POST&quot;, url, headers=headers, data=payload, verify=False)<br>print(response.text)</pre><p>Above code snippet requires wxd_instance_id, wxd_url and wxd_token.</p><h4>wxd_instance_id : <strong>Get the wxd_instance_id details from instance details page.</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Iu91ekzrR0nc51VRw3tafQ.png" /></figure><h4>wxd_url : <strong>Get IBM watsonx.data application endpoint from spark engine details page.</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*neY9vCiKvi0SUR4NaY5-Pg.png" /></figure><h4>Get the ZEN API Key from CPD and base64 encode it</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MYBx8MMob59vhMLX.png" /></figure><p><strong>Click Profile and Settings and generate new apikey</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Rg_dnwveD_50mDGw.png" /></figure><p><strong>Get the base64 encoding of the apikey using the command below where cpadmin is the cpd user.</strong></p><pre>echo -n &quot;cpadmin:&lt;apikey&gt;&quot; | base64</pre><p>Now, we are all set and we can go ahead and execute this python code</p><pre>python3 run-spark-job-adls-native.py <br>{&quot;application_id&quot;:&quot;525cfceb-5436–4dc7–84eb-f80c0deba975&quot;,&quot;spark_version&quot;:&quot;3.4&quot;,&quot;state&quot;:&quot;ACCEPTED&quot;,&quot;template_id&quot;:&quot;spark-3.4-cp4d-wxd-template&quot;}</pre><h3>4. Checking spark application logs</h3><p>Locate the volume associated with the spark engine and download the spark driver logs to see the output logs</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XNKIz_zcTlV97CwwcWw4CQ.png" /></figure><p>In the driver logs, you can see the execution logs in the following format</p><pre>======Showing Database In Beginning=========<br>24/09/11 05:58:58 INFO SharedState: Setting hive.metastore.warehouse.dir (&#39;null&#39;) to the value of spark.sql.warehouse.dir.<br>---<br>24/09/11 05:59:06 INFO CodeGenerator: Code generated in 81.268041 ms<br>+--------------------+<br>|           namespace|<br>+--------------------+<br>|          adls_casdb|<br>|             default|<br>|wxd_system_data_d...|<br>+--------------------+<br>===Done: Showing Database In Beginning====<br>---<br>======Creating Database=========<br>24/09/11 05:59:09 INFO HiveCatalog: Created namespace: adls_cassparkdb<br>===Done: Creating Database====<br>---<br>======Showing Database After Creation=========<br>---<br>+--------------------+<br>|           namespace|<br>+--------------------+<br>|          adls_casdb|<br>|     adls_cassparkdb|<br>|             default|<br>|wxd_system_data_d...|<br>+--------------------+<br><br>===Done: Showing Database After Creation====<br>---<br>======Creating Table=========<br>24/09/11 05:59:10 INFO BaseMetastoreCatalog: Table properties set at catalog level through catalog properties: {}<br>24/09/11 05:59:10 INFO BaseMetastoreCatalog: Table properties enforced at catalog level through catalog properties: {}<br>24/09/11 05:59:14 INFO HiveTableOperations: Committed to table adls_casspark.adls_cassparkdb.adls_cassparktb with the new metadata location abfss://pyspark@sparkadlsiae.dfs.core.windows.net/adls_cassparkdb/adls_cassparktb/metadata/00000-451eecfc-06c2-4bc0-b808-749d99820a6d.metadata.json<br>24/09/11 05:59:14 INFO BaseMetastoreTableOperations: Successfully committed to table adls_casspark.adls_cassparkdb.adls_cassparktb in 3441 ms<br>24/09/11 05:59:14 WARN GarbageCollectionMetrics: To enable non-built-in garbage collector(s) List(scavenge), users should configure it(them) to spark.eventLog.gcMetrics.youngGenerationGarbageCollectors or spark.eventLog.gcMetrics.oldGenerationGarbageCollectors<br>24/09/11 05:59:14 WARN GarbageCollectionMetrics: To enable non-built-in garbage collector(s) List(global, scavenge), users should configure it(them) to spark.eventLog.gcMetrics.youngGenerationGarbageCollectors or spark.eventLog.gcMetrics.oldGenerationGarbageCollectors<br>24/09/11 05:59:14 INFO BaseMetastoreTableOperations: Refreshing table metadata from new version: abfss://pyspark@sparkadlsiae.dfs.core.windows.net/adls_cassparkdb/adls_cassparktb/metadata/00000-451eecfc-06c2-4bc0-b808-749d99820a6d.metadata.json<br>===Done: Table Creation===<br>--<br>======List Table=========<br>24/09/11 05:59:14 INFO CodeGenerator: Code generated in 36.707946 ms<br>+---------------+---------------+-----------+<br>|      namespace|      tableName|isTemporary|<br>+---------------+---------------+-----------+<br>|adls_cassparkdb|adls_cassparktb|      false|<br>+---------------+---------------+-----------+<br>====Done: List Table====<br>---<br>=======Inserting Data========= <br>---<br>24/09/11 05:59:22 INFO AppendDataExec: Data source write support IcebergBatchWrite(table=adls_casspark.adls_cassparkdb.adls_cassparktb, format=PARQUET) is committing.<br>24/09/11 05:59:22 INFO SparkWrite: Committing append with 1 new data files to table adls_casspark.adls_cassparkdb.adls_cassparktb<br>24/09/11 05:59:25 INFO HiveTableOperations: Committed to table adls_casspark.adls_cassparkdb.adls_cassparktb with the new metadata location abfss://pyspark@sparkadlsiae.dfs.core.windows.net/adls_cassparkdb/adls_cassparktb/metadata/00001-a2b7b0f9-b70c-47a2-98e3-31d6c754a144.metadata.json<br>24/09/11 05:59:25 INFO BaseMetastoreTableOperations: Successfully committed to table adls_casspark.adls_cassparkdb.adls_cassparktb in 706 ms<br>24/09/11 05:59:25 INFO SnapshotProducer: Committed snapshot 4146283302251872520 (MergeAppend)<br>24/09/11 05:59:25 INFO BaseMetastoreTableOperations: Refreshing table metadata from new version: abfss://pyspark@sparkadlsiae.dfs.core.windows.net/adls_cassparkdb/adls_cassparktb/metadata/00001-a2b7b0f9-b70c-47a2-98e3-31d6c754a144.metadata.json<br>24/09/11 05:59:25 INFO LoggingMetricsReporter: Received metrics report: CommitReport{tableName=adls_casspark.adls_cassparkdb.adls_cassparktb, snapshotId=4146283302251872520, sequenceNumber=1, operation=append, commitMetrics=CommitMetricsResult{totalDuration=TimerResult{timeUnit=NANOSECONDS, totalDuration=PT2.694443485S, count=1}, attempts=CounterResult{unit=COUNT, value=1}, addedDataFiles=CounterResult{unit=COUNT, value=1}, removedDataFiles=null, totalDataFiles=CounterResult{unit=COUNT, value=1}, addedDeleteFiles=null, addedEqualityDeleteFiles=null, addedPositionalDeleteFiles=null, removedDeleteFiles=null, removedEqualityDeleteFiles=null, removedPositionalDeleteFiles=null, totalDeleteFiles=CounterResult{unit=COUNT, value=0}, addedRecords=CounterResult{unit=COUNT, value=1}, removedRecords=null, totalRecords=CounterResult{unit=COUNT, value=1}, addedFilesSizeInBytes=CounterResult{unit=BYTES, value=1099}, removedFilesSizeInBytes=null, totalFilesSizeInBytes=CounterResult{unit=BYTES, value=1099}, addedPositionalDeletes=null, removedPositionalDeletes=null, totalPositionalDeletes=CounterResult{unit=COUNT, value=0}, addedEqualityDeletes=null, removedEqualityDeletes=null, totalEqualityDeletes=CounterResult{unit=COUNT, value=0}}, metadata={engine-version=3.4.2, app-id=app-20240911055856-0000, engine-name=spark, iceberg-version=Apache Iceberg 9731592.dirty (commit 973159218266c2ab1527ba8bf89dd01c8f133017)}}<br>24/09/11 05:59:25 INFO SparkWrite: Committed in 2753 ms<br>24/09/11 05:59:25 INFO AppendDataExec: Data source write support IcebergBatchWrite(table=adls_casspark.adls_cassparkdb.adls_cassparktb, format=PARQUET) committed.<br>===Done: Inserting Data====<br><br>=======Querying Data========== <br>24/09/11 05:59:25 INFO V2ScanRelationPushDown: <br>Output: id#67, name#68, age#69, salary#70<br>---<br>24/09/11 05:59:27 INFO CodeGenerator: Code generated in 89.688018 ms<br>+---+----+---+--------+<br>| id|name|age|  salary|<br>+---+----+---+--------+<br>|  1|  aa| 18|12000.00|<br>+---+----+---+--------+<br><br>===Done: Querying Data===<br>---<br>======Cleaning Database=========<br>24/09/11 05:59:28 INFO HiveCatalog: Dropped table: adls_cassparkdb.adls_cassparktb<br><br>---<br>---<br>24/09/11 05:59:54 INFO CodeGenerator: Code generated in 15.34621 ms<br>24/09/11 05:59:56 INFO DeleteReachableFilesSparkAction: Deleted 6 total files<br>24/09/11 05:59:56 INFO HiveCatalog: Dropped namespace: adls_cassparkdb<br>====Done: Cleaning Database====<br>---<br>---<br>======Showing Database After Cleanup=========<br>---<br>+--------------------+<br>|           namespace|<br>+--------------------+<br>|          adls_casdb|<br>|             default|<br>|wxd_system_data_d...|<br>+--------------------+<br><br>===Done: Showing Database After Cleanup====</pre><h3>Conclusion</h3><p>This tutorial was a demo on how you can use ADLS storage with DAS (Data Access Service) feature in spark engine (IBM watsonx.data) on CPD.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75d3cfb8fba7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>