<?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 Failed to merge fields 'LIFNR' and 'LIFNR'. Failed to merge incompatible data types IntegerType and StringType in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/failed-to-merge-fields-lifnr-and-lifnr-failed-to-merge/m-p/3966#M833</link>
    <description>&lt;P&gt;I am have imported a csv file using spark.read method, i have used custom schema and declared the type of the column as string.&lt;/P&gt;&lt;P&gt;i have delta table and the type of the column in the table is also string. &lt;/P&gt;&lt;P&gt;I am getting failed to merge fields errors in spark.write.format('delta')  command,&lt;/P&gt;&lt;P&gt;can you please suggest. &lt;/P&gt;</description>
    <pubDate>Fri, 26 May 2023 08:12:42 GMT</pubDate>
    <dc:creator>vijaykumarbotla</dc:creator>
    <dc:date>2023-05-26T08:12:42Z</dc:date>
    <item>
      <title>Failed to merge fields 'LIFNR' and 'LIFNR'. Failed to merge incompatible data types IntegerType and StringType</title>
      <link>https://community.databricks.com/t5/data-engineering/failed-to-merge-fields-lifnr-and-lifnr-failed-to-merge/m-p/3966#M833</link>
      <description>&lt;P&gt;I am have imported a csv file using spark.read method, i have used custom schema and declared the type of the column as string.&lt;/P&gt;&lt;P&gt;i have delta table and the type of the column in the table is also string. &lt;/P&gt;&lt;P&gt;I am getting failed to merge fields errors in spark.write.format('delta')  command,&lt;/P&gt;&lt;P&gt;can you please suggest. &lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2023 08:12:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/failed-to-merge-fields-lifnr-and-lifnr-failed-to-merge/m-p/3966#M833</guid>
      <dc:creator>vijaykumarbotla</dc:creator>
      <dc:date>2023-05-26T08:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Failed to merge fields 'LIFNR' and 'LIFNR'. Failed to merge incompatible data types IntegerType and StringType</title>
      <link>https://community.databricks.com/t5/data-engineering/failed-to-merge-fields-lifnr-and-lifnr-failed-to-merge/m-p/3967#M834</link>
      <description>&lt;P&gt;apparently the schema was not applied to your df.&lt;/P&gt;&lt;P&gt;You will have to check why (assuming the delta table col is indeed of type string).  Without sharing code it is impossible to know.&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2023 09:25:06 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/failed-to-merge-fields-lifnr-and-lifnr-failed-to-merge/m-p/3967#M834</guid>
      <dc:creator>-werners-</dc:creator>
      <dc:date>2023-05-26T09:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: Failed to merge fields 'LIFNR' and 'LIFNR'. Failed to merge incompatible data types IntegerType and StringType</title>
      <link>https://community.databricks.com/t5/data-engineering/failed-to-merge-fields-lifnr-and-lifnr-failed-to-merge/m-p/3968#M835</link>
      <description>&lt;P&gt;@Vijay Kumar​&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Check your schema of the table using DESCRIBE TABLE and the dataframe you loaded using df.printSchema() and compare which column has a mismatch. You need to see if your custom schema is matching the table schema.  &lt;/LI&gt;&lt;LI&gt;MergeSchema will support only the schemas that it can typecast. &lt;/LI&gt;&lt;LI&gt; If you want to completely recreate the table schema with the ones of dataframes, you can use overwriteSchema option. &lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please share your code so that we can look and help you. &lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2023 10:21:19 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/failed-to-merge-fields-lifnr-and-lifnr-failed-to-merge/m-p/3968#M835</guid>
      <dc:creator>pvignesh92</dc:creator>
      <dc:date>2023-05-26T10:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: Failed to merge fields 'LIFNR' and 'LIFNR'. Failed to merge incompatible data types IntegerType and StringType</title>
      <link>https://community.databricks.com/t5/data-engineering/failed-to-merge-fields-lifnr-and-lifnr-failed-to-merge/m-p/3969#M836</link>
      <description>&lt;P&gt;Hi @Vijay Kumar​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for posting your question in our community! We are happy to assist you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 27 May 2023 08:07:28 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/failed-to-merge-fields-lifnr-and-lifnr-failed-to-merge/m-p/3969#M836</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-05-27T08:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: Failed to merge fields 'LIFNR' and 'LIFNR'. Failed to merge incompatible data types IntegerType and StringType</title>
      <link>https://community.databricks.com/t5/data-engineering/failed-to-merge-fields-lifnr-and-lifnr-failed-to-merge/m-p/3970#M837</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;the issue is resolved, i have executed column conversion and from next run the code is working fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;df = spark.read.format("delta").load("/mnt/dev/deltav2/X")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;df= df.withColumn("LIFNR", df.LIFNR.cast("string"))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;df.write.format('delta').option("overwriteSchema", "true").mode('overwrite').save("/mnt/dev/deltav2/X")&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2023 16:12:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/failed-to-merge-fields-lifnr-and-lifnr-failed-to-merge/m-p/3970#M837</guid>
      <dc:creator>vijaykumarbotla</dc:creator>
      <dc:date>2023-05-29T16:12:17Z</dc:date>
    </item>
  </channel>
</rss>

