<?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 Spark Handling White Space as NULL in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/spark-handling-white-space-as-null/m-p/65810#M7003</link>
    <description>&lt;P&gt;I have a very strange thing happening.&amp;nbsp; I'm importing a csv file and nulls and blanks are being interpreted correctly.&amp;nbsp; What is strange is that a column that regularly has a single space character value is having the single space converted to null.&lt;BR /&gt;&lt;BR /&gt;I'm using this to import the file data:&lt;/P&gt;&lt;P&gt;df = spark.read.format("csv").options(mode='FAILFAST', multiLine=True, escape='"').csv(path=source_path, header=True, inferSchema=False).select("*", "_metadata.file_name").withColumns({"date1": lit(currentdt), "GUID": lit(guid)})&lt;/P&gt;&lt;P&gt;I've tried including option&amp;nbsp;&lt;SPAN&gt;nullValue&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;" " but then all blanks are being imported as blank.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm new to this and sure I'm doing something wrong.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 08 Apr 2024 13:41:57 GMT</pubDate>
    <dc:creator>Chrispy</dc:creator>
    <dc:date>2024-04-08T13:41:57Z</dc:date>
    <item>
      <title>Spark Handling White Space as NULL</title>
      <link>https://community.databricks.com/t5/get-started-discussions/spark-handling-white-space-as-null/m-p/65810#M7003</link>
      <description>&lt;P&gt;I have a very strange thing happening.&amp;nbsp; I'm importing a csv file and nulls and blanks are being interpreted correctly.&amp;nbsp; What is strange is that a column that regularly has a single space character value is having the single space converted to null.&lt;BR /&gt;&lt;BR /&gt;I'm using this to import the file data:&lt;/P&gt;&lt;P&gt;df = spark.read.format("csv").options(mode='FAILFAST', multiLine=True, escape='"').csv(path=source_path, header=True, inferSchema=False).select("*", "_metadata.file_name").withColumns({"date1": lit(currentdt), "GUID": lit(guid)})&lt;/P&gt;&lt;P&gt;I've tried including option&amp;nbsp;&lt;SPAN&gt;nullValue&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;" " but then all blanks are being imported as blank.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm new to this and sure I'm doing something wrong.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2024 13:41:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/spark-handling-white-space-as-null/m-p/65810#M7003</guid>
      <dc:creator>Chrispy</dc:creator>
      <dc:date>2024-04-08T13:41:57Z</dc:date>
    </item>
  </channel>
</rss>

