<?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: Incorrect reading csv format with inferSchema in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/incorrect-reading-csv-format-with-inferschema/m-p/10336#M5539</link>
    <description>&lt;P&gt;Thanks @Ajay Pandey​. &lt;/P&gt;</description>
    <pubDate>Thu, 02 Feb 2023 02:49:29 GMT</pubDate>
    <dc:creator>Tracy_</dc:creator>
    <dc:date>2023-02-02T02:49:29Z</dc:date>
    <item>
      <title>Incorrect reading csv format with inferSchema</title>
      <link>https://community.databricks.com/t5/data-engineering/incorrect-reading-csv-format-with-inferschema/m-p/10333#M5536</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;There is a CSV with a column ID (format: 8-digits &amp;amp;  "&lt;B&gt;D&lt;/B&gt;" at the end).&lt;/P&gt;&lt;P&gt;When trying to read a csv with .&lt;B&gt;option("inferSchema", "true"), &lt;/B&gt; it returns the ID as double and trim the "&lt;B&gt;D&lt;/B&gt;". Is there any idea (apart from &lt;B&gt;inferSchema=False) &lt;/B&gt;to get correct result? Thanks for help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below options was tried and also failed.&lt;/P&gt;&lt;P&gt;options(delimiter=",", sep = ",", header=True, inferSchema=True,multiline=True, quote="\"", escape="\"")&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image.png"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/749i70764E823CB2BF31/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 05:16:53 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/incorrect-reading-csv-format-with-inferschema/m-p/10333#M5536</guid>
      <dc:creator>Tracy_</dc:creator>
      <dc:date>2023-02-01T05:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect reading csv format with inferSchema</title>
      <link>https://community.databricks.com/t5/data-engineering/incorrect-reading-csv-format-with-inferschema/m-p/10334#M5537</link>
      <description>&lt;P&gt;Hi @tracy ng​&amp;nbsp;&lt;/P&gt;&lt;P&gt;By default, spark treating as a double value for all the numbers ending with &lt;B&gt;D &lt;/B&gt;or &lt;B&gt;F&lt;/B&gt;&lt;/P&gt;&lt;P&gt;I think you should connect with databricks regarding this.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 07:17:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/incorrect-reading-csv-format-with-inferschema/m-p/10334#M5537</guid>
      <dc:creator>Ajay-Pandey</dc:creator>
      <dc:date>2023-02-01T07:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect reading csv format with inferSchema</title>
      <link>https://community.databricks.com/t5/data-engineering/incorrect-reading-csv-format-with-inferschema/m-p/10335#M5538</link>
      <description>&lt;P&gt;It can be solved, for example, by specifying the schema with ID as string.&lt;/P&gt;&lt;P&gt;If you don't want to specify schema, better would be autoloader as you can specify hint:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;spark.readStream
  .format("cloudFiles")
  .option("cloudFiles.format", "csv")
  .option("cloudFiles.schemaLocation", checkpoint_path)
  .option("cloudFiles.schemaHints", "ID String")
  .option("inferSchema", True)
  .option("mergeSchema", True)
  .load(folder)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 09:33:58 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/incorrect-reading-csv-format-with-inferschema/m-p/10335#M5538</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2023-02-01T09:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect reading csv format with inferSchema</title>
      <link>https://community.databricks.com/t5/data-engineering/incorrect-reading-csv-format-with-inferschema/m-p/10336#M5539</link>
      <description>&lt;P&gt;Thanks @Ajay Pandey​. &lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 02:49:29 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/incorrect-reading-csv-format-with-inferschema/m-p/10336#M5539</guid>
      <dc:creator>Tracy_</dc:creator>
      <dc:date>2023-02-02T02:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect reading csv format with inferSchema</title>
      <link>https://community.databricks.com/t5/data-engineering/incorrect-reading-csv-format-with-inferschema/m-p/10337#M5540</link>
      <description>&lt;P&gt;Thanks @Hubert Dudek​&amp;nbsp;, &lt;/P&gt;&lt;P&gt;Becasue the reading file is used to loop different source from different directory with different schema and dynamic column name (sometimes named ID, sometime named SID etc.), it seems the autoloader is not applicable to the case. I wonder is there any option to disable this feature (treating column as double when there is trailing&amp;nbsp;D). &lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 02:56:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/incorrect-reading-csv-format-with-inferschema/m-p/10337#M5540</guid>
      <dc:creator>Tracy_</dc:creator>
      <dc:date>2023-02-02T02:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect reading csv format with inferSchema</title>
      <link>https://community.databricks.com/t5/data-engineering/incorrect-reading-csv-format-with-inferschema/m-p/10338#M5541</link>
      <description>&lt;P&gt;Hi @tracy ng​&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>Tue, 11 Apr 2023 04:52:21 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/incorrect-reading-csv-format-with-inferschema/m-p/10338#M5541</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-04-11T04:52:21Z</dc:date>
    </item>
  </channel>
</rss>

