<?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 Error when running OPTIMIZE on a Delta table with generated columns in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/error-when-running-optimize-on-a-delta-table-with-generated/m-p/7414#M3302</link>
    <description>&lt;P&gt;I am seeing an error when running OPTIMIZE on a Delta table with generated columns:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;com.databricks.sql.transaction.tahoe.schema.DeltaInvariantViolationException: CHECK constraint Generated Column (created &amp;lt;=&amp;gt; now()) violated by row with values:&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;&amp;nbsp;- created : 1672360020111000&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using a cluster with runtime &lt;B&gt;11.3 LTS (includes Apache Spark 3.3.0, Scala 2.12)&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas how I can successfully OPTIMIZE this table?&lt;/P&gt;</description>
    <pubDate>Mon, 20 Mar 2023 16:55:31 GMT</pubDate>
    <dc:creator>jericksoncea</dc:creator>
    <dc:date>2023-03-20T16:55:31Z</dc:date>
    <item>
      <title>Error when running OPTIMIZE on a Delta table with generated columns</title>
      <link>https://community.databricks.com/t5/data-engineering/error-when-running-optimize-on-a-delta-table-with-generated/m-p/7414#M3302</link>
      <description>&lt;P&gt;I am seeing an error when running OPTIMIZE on a Delta table with generated columns:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;com.databricks.sql.transaction.tahoe.schema.DeltaInvariantViolationException: CHECK constraint Generated Column (created &amp;lt;=&amp;gt; now()) violated by row with values:&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;&amp;nbsp;- created : 1672360020111000&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using a cluster with runtime &lt;B&gt;11.3 LTS (includes Apache Spark 3.3.0, Scala 2.12)&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas how I can successfully OPTIMIZE this table?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2023 16:55:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-when-running-optimize-on-a-delta-table-with-generated/m-p/7414#M3302</guid>
      <dc:creator>jericksoncea</dc:creator>
      <dc:date>2023-03-20T16:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: Error when running OPTIMIZE on a Delta table with generated columns</title>
      <link>https://community.databricks.com/t5/data-engineering/error-when-running-optimize-on-a-delta-table-with-generated/m-p/7415#M3303</link>
      <description>&lt;P&gt;Have you applied any constraints on your table?&lt;/P&gt;&lt;P&gt;As it's giving errors for constraint&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2023 18:47:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-when-running-optimize-on-a-delta-table-with-generated/m-p/7415#M3303</guid>
      <dc:creator>Ajay-Pandey</dc:creator>
      <dc:date>2023-03-20T18:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: Error when running OPTIMIZE on a Delta table with generated columns</title>
      <link>https://community.databricks.com/t5/data-engineering/error-when-running-optimize-on-a-delta-table-with-generated/m-p/7416#M3304</link>
      <description>&lt;P&gt;It appears the constraint is related to the generated column:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/delta/generated-columns.html" alt="https://docs.databricks.com/delta/generated-columns.html" target="_blank"&gt;https://docs.databricks.com/delta/generated-columns.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"For example, you can automatically generate a date column (for partitioning the table by date) from the timestamp column; any writes into the table need only specify the data for the timestamp column. However, if you explicitly provide values for them, the values must satisfy the&amp;nbsp;&lt;A href="https://docs.databricks.com/tables/constraints.html" alt="https://docs.databricks.com/tables/constraints.html" target="_blank"&gt;constraint&lt;/A&gt;&amp;nbsp;(&amp;lt;value&amp;gt;&amp;nbsp;&amp;lt;=&amp;gt;&amp;nbsp;&amp;lt;generation&amp;nbsp;expression&amp;gt;)&amp;nbsp;IS&amp;nbsp;TRUE&amp;nbsp;or the write will fail with an error."&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 05:39:09 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-when-running-optimize-on-a-delta-table-with-generated/m-p/7416#M3304</guid>
      <dc:creator>jericksoncea</dc:creator>
      <dc:date>2023-03-21T05:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: Error when running OPTIMIZE on a Delta table with generated columns</title>
      <link>https://community.databricks.com/t5/data-engineering/error-when-running-optimize-on-a-delta-table-with-generated/m-p/7417#M3305</link>
      <description>&lt;P&gt;Hi @Jeff Erickson​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your question! To assist you better, please take a moment to review the answer and let me know if it best fits your needs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help us select the best solution by clicking on "Select As Best" if it does.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your feedback will help us ensure that we are providing the best possible service to you. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 03:06:52 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-when-running-optimize-on-a-delta-table-with-generated/m-p/7417#M3305</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-03-22T03:06:52Z</dc:date>
    </item>
  </channel>
</rss>

