<?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: Error creating delta table over an existing delta schema in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/error-creating-delta-table-over-an-existing-delta-schema/m-p/31141#M22659</link>
    <description>&lt;P&gt;Hello again, @Thulasitharan Govindaraj​&amp;nbsp;- Thank you for your question and your patience. As usual, we'll give our members a chance to respond and we'll come back to this if we need to.&lt;/P&gt;</description>
    <pubDate>Mon, 24 Jan 2022 15:52:39 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-01-24T15:52:39Z</dc:date>
    <item>
      <title>Error creating delta table over an existing delta schema</title>
      <link>https://community.databricks.com/t5/data-engineering/error-creating-delta-table-over-an-existing-delta-schema/m-p/31140#M22658</link>
      <description>&lt;P&gt;I created a delta table through a cluster over a dbfs location .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Schema :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create external table tmp_db.delta_data(&lt;/P&gt;&lt;P&gt;delta_id int ,&lt;/P&gt;&lt;P&gt;delta_name varchar(20) , &lt;/P&gt;&lt;P&gt;delta_variation decimal(10,4) ,&lt;/P&gt;&lt;P&gt;delta_incoming_timestamp timestamp,&lt;/P&gt;&lt;P&gt;delta_date date generated always as (cast (split(cast(delta_incoming_timestamp as string),' ')[0] as date)) comment 'Generated', -- cound use date(col)&lt;/P&gt;&lt;P&gt;delta_time string generated always as (cast(split(cast(split(cast(delta_incoming_timestamp as string),' ')[1] as string),'\\.')[0] as string)) comment 'Generated',&lt;/P&gt;&lt;P&gt;delta_milliseconds string generated always as (cast(split(cast(split(cast(delta_incoming_timestamp as string),' ')[1] as string),'\\.')[1] as string)) comment 'Generated'&lt;/P&gt;&lt;P&gt;)&amp;nbsp;&lt;/P&gt;&lt;P&gt;using delta&amp;nbsp;&lt;/P&gt;&lt;P&gt;partitioned by (delta_date)&lt;/P&gt;&lt;P&gt;location 'dbfs:/tmp/tables_base/tmp_db/delta_data';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It got created for the first time. I inserted few rows into the table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I dropped the table as it is a external table and created the table in another databricks cluster. I'm getting the below error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;== Specified ==&lt;/P&gt;&lt;P&gt;root&lt;/P&gt;&lt;P&gt;-- delta_id: integer (nullable = true)&lt;/P&gt;&lt;P&gt;-- delta_name: varchar(20) (nullable = true)&lt;/P&gt;&lt;P&gt;-- delta_variation: decimal(10,4) (nullable = true)&lt;/P&gt;&lt;P&gt;-- delta_incoming_timestamp: timestamp (nullable = true)&lt;/P&gt;&lt;P&gt;-- delta_date: date (nullable = true)&lt;/P&gt;&lt;P&gt;-- delta_time: string (nullable = true)&lt;/P&gt;&lt;P&gt;-- delta_milliseconds: string (nullable = true)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;== Existing ==&lt;/P&gt;&lt;P&gt;root&lt;/P&gt;&lt;P&gt;-- delta_id: integer (nullable = true)&lt;/P&gt;&lt;P&gt;-- delta_name: string (nullable = true)&lt;/P&gt;&lt;P&gt;-- delta_variation: decimal(10,4) (nullable = true)&lt;/P&gt;&lt;P&gt;-- delta_incoming_timestamp: timestamp (nullable = true)&lt;/P&gt;&lt;P&gt;-- delta_date: date (nullable = true)&lt;/P&gt;&lt;P&gt;-- delta_time: string (nullable = true)&lt;/P&gt;&lt;P&gt;-- delta_milliseconds: string (nullable = true)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;== Differences==&lt;/P&gt;&lt;P&gt;- Specified metadata for field delta_name is different from existing schema:&lt;/P&gt;&lt;P&gt;  Specified: {}&lt;/P&gt;&lt;P&gt;  Existing:  {"__CHAR_VARCHAR_TYPE_STRING":"varchar(20)"}&lt;/P&gt;&lt;P&gt;- Specified type for delta_name is different from existing schema:&lt;/P&gt;&lt;P&gt;  Specified: varchar(20)&lt;/P&gt;&lt;P&gt;  Existing:  string&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;I don't understand why this metadata got added to a varchar column and why the varchar column got saved as string. And If it is a default behavior , How can I specify the config  {"__CHAR_VARCHAR_TYPE_STRING":"varchar(20)"} for that particular column ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Jan 2022 07:51:16 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-creating-delta-table-over-an-existing-delta-schema/m-p/31140#M22658</guid>
      <dc:creator>study_community</dc:creator>
      <dc:date>2022-01-23T07:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: Error creating delta table over an existing delta schema</title>
      <link>https://community.databricks.com/t5/data-engineering/error-creating-delta-table-over-an-existing-delta-schema/m-p/31141#M22659</link>
      <description>&lt;P&gt;Hello again, @Thulasitharan Govindaraj​&amp;nbsp;- Thank you for your question and your patience. As usual, we'll give our members a chance to respond and we'll come back to this if we need to.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 15:52:39 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-creating-delta-table-over-an-existing-delta-schema/m-p/31141#M22659</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-24T15:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: Error creating delta table over an existing delta schema</title>
      <link>https://community.databricks.com/t5/data-engineering/error-creating-delta-table-over-an-existing-delta-schema/m-p/31142#M22660</link>
      <description>&lt;P&gt;varchartype is only available as from spark 3.1 I think.&lt;/P&gt;&lt;P&gt;&lt;A href="https://spark.apache.org/docs/latest/sql-ref-datatypes.html" alt="https://spark.apache.org/docs/latest/sql-ref-datatypes.html" target="_blank"&gt;https://spark.apache.org/docs/latest/sql-ref-datatypes.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The link is for spark 3.2, and 3.1 also has varchartype.  So can you check your spark version?&lt;/P&gt;&lt;P&gt;Also if the table definition still exists you need to either use schema drift or else remove the table completely, or explicitely change the col types.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2022 14:28:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/error-creating-delta-table-over-an-existing-delta-schema/m-p/31142#M22660</guid>
      <dc:creator>-werners-</dc:creator>
      <dc:date>2022-01-25T14:28:51Z</dc:date>
    </item>
  </channel>
</rss>

