<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Discrepancy in Record Count in DLT Pipeline Data Quality Tab in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/discrepancy-in-record-count-in-dlt-pipeline-data-quality-tab/m-p/81175#M36247</link>
    <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/9"&gt;@Retired_mod&lt;/a&gt;. This makes sense. But can you elaborate more on how to use spark's streaming metrics? Where they can be found or are there any articles that explains how it works? Thanks!&lt;/P&gt;</description>
    <pubDate>Tue, 30 Jul 2024 15:22:12 GMT</pubDate>
    <dc:creator>YS1</dc:creator>
    <dc:date>2024-07-30T15:22:12Z</dc:date>
    <item>
      <title>Discrepancy in Record Count in DLT Pipeline Data Quality Tab</title>
      <link>https://community.databricks.com/t5/data-engineering/discrepancy-in-record-count-in-dlt-pipeline-data-quality-tab/m-p/80625#M36089</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have set up a DLT pipeline where I ingest data from a Kafka topic into a table. Then, I create another table that filters records from the first table. However, I'm facing an issue:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;When I check the Data Quality tab for the second table, it shows a large number of written records, which is bigger than the number of records in the first table.&lt;/LI&gt;&lt;LI&gt;But, when I query the second table, the count matches the expected number of records.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I'm trying to understand why the DLT pipeline shows a different number than what is actually written to the table.&lt;/P&gt;&lt;P&gt;Below is a screenshot of the pipeline structure and the code for constructing the second table:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="YS1_0-1721938771644.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/9903iAD9400E8D237C983/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="YS1_0-1721938771644.png" alt="YS1_0-1721938771644.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;.table(
  name="bronze_eventlog_inventory_management",
    table_properties={"quality": "bronze",
                    "pipelines.autoOptimize.managed": "true",                    "pipelines.reset.allowed": "true"},
  temporary=False)

def create_bronze_table():

  
    master_keys_list = ["column_a", "column_b", "column_c", "column_d", "column_e", "column_f", "column_g"]

    event_ids_list = ["1", "2", "3", "4", "5", "6", "7", "8"]

    df_src=(dlt
              .read_stream("bronze_eventlog")
              .filter(col("id").isin(event_ids_list))
              .withColumn("parsed_data", from_json(col("message_content"), "map&amp;lt;string,string&amp;gt;"))
              .select("x", "y", "z", "id", explode(col("parsed_data")).alias("key", "value"))
              .withColumn("key", when(lower(col("key")) == "column_a", lit("column_a"))
                                .otherwise(col("key")))
             )
    
    df_inv_man = (df_src
                  .groupby("x", "y", "z", "id")
                  .agg(*[first(when(col("key") == k, col("value")), ignorenulls=True).alias(k) for k in master_keys_list]))

    return (df_inv_man)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone help me understand the discrepancy in the record count between the Data Quality tab and the actual table?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2024 20:49:55 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/discrepancy-in-record-count-in-dlt-pipeline-data-quality-tab/m-p/80625#M36089</guid>
      <dc:creator>YS1</dc:creator>
      <dc:date>2024-07-25T20:49:55Z</dc:date>
    </item>
    <item>
      <title>Re: Discrepancy in Record Count in DLT Pipeline Data Quality Tab</title>
      <link>https://community.databricks.com/t5/data-engineering/discrepancy-in-record-count-in-dlt-pipeline-data-quality-tab/m-p/81175#M36247</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/9"&gt;@Retired_mod&lt;/a&gt;. This makes sense. But can you elaborate more on how to use spark's streaming metrics? Where they can be found or are there any articles that explains how it works? Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2024 15:22:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/discrepancy-in-record-count-in-dlt-pipeline-data-quality-tab/m-p/81175#M36247</guid>
      <dc:creator>YS1</dc:creator>
      <dc:date>2024-07-30T15:22:12Z</dc:date>
    </item>
  </channel>
</rss>

