<?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: How to change line separator for csv file exported from dataframe in databricks in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-change-line-separator-for-csv-file-exported-from/m-p/27596#M19461</link>
    <description>&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi @tunguyen90,&lt;/P&gt;&lt;P&gt;Please go through the below answer,&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.databricks.com/questions/12831/custom-line-separator.html" target="_blank"&gt;https://forums.databricks.com/questions/12831/custom-line-separator.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Nov 2019 07:39:43 GMT</pubDate>
    <dc:creator>shyam_9</dc:creator>
    <dc:date>2019-11-13T07:39:43Z</dc:date>
    <item>
      <title>How to change line separator for csv file exported from dataframe in databricks</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-change-line-separator-for-csv-file-exported-from/m-p/27595#M19460</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Currently, I'm facing problem with line separator inside csv file, which is exported from data frame in Azure Databricks (version Spark 2.4.3) to Azure Blob storage. All those csv files contains&lt;B&gt; LF&lt;/B&gt; as line-separator. I need to have &lt;B&gt;CRLF (\r\n)&lt;/B&gt; as &lt;B&gt;line separator&lt;/B&gt; in those csv files. Although I've tried different ways to change that default line separator into my target line separator, it doesn't work. Up to now, I tried following ways &lt;/P&gt;
&lt;P&gt;1. In databricks notebook, I added option to customize line separator as following.&lt;/P&gt;
&lt;P&gt;df.write.format("com.databricks.spark.csv").option("header","true").&lt;B&gt;option("lineSep",'\r\n')&lt;/B&gt;.mode("overwrite").save(target_folder);&lt;/P&gt;
&lt;P&gt;Looks like such option("lineSep") doesn't work yet, at least in my version Spark 2.4.3. I checked in other similar question, in forum they said that this doesn't work as well in Spark 2.4.4.&lt;/P&gt;
&lt;P&gt;2. In databricks notebook, I tried to add following line &lt;/P&gt;
&lt;P&gt;&lt;B&gt;spark._jvm.java.lang.System.setProperty("line.separator", "\r\n");&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;Looks like that such setProperty didn't change also the default line separator once parsing and writing data to output in csv files in Azure blob storage.&lt;/P&gt;
&lt;P&gt;Maybe someone has other suggestion / solution for this problem ? Thanks a lot for your help.&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2019 15:41:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-change-line-separator-for-csv-file-exported-from/m-p/27595#M19460</guid>
      <dc:creator>tunguyen90</dc:creator>
      <dc:date>2019-11-08T15:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to change line separator for csv file exported from dataframe in databricks</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-change-line-separator-for-csv-file-exported-from/m-p/27596#M19461</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi @tunguyen90,&lt;/P&gt;&lt;P&gt;Please go through the below answer,&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.databricks.com/questions/12831/custom-line-separator.html" target="_blank"&gt;https://forums.databricks.com/questions/12831/custom-line-separator.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 07:39:43 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-change-line-separator-for-csv-file-exported-from/m-p/27596#M19461</guid>
      <dc:creator>shyam_9</dc:creator>
      <dc:date>2019-11-13T07:39:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to change line separator for csv file exported from dataframe in databricks</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-change-line-separator-for-csv-file-exported-from/m-p/27597#M19462</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;The linked answer seems to be about reading. @tunguyen90 asked about writing. Aren't they distinct issues? I am also looking for latest info on the writer.&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2020 17:35:38 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-change-line-separator-for-csv-file-exported-from/m-p/27597#M19462</guid>
      <dc:creator>neilbest-db</dc:creator>
      <dc:date>2020-05-28T17:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to change line separator for csv file exported from dataframe in databricks</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-change-line-separator-for-csv-file-exported-from/m-p/27598#M19463</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Have you got the solution for above problem.Kindly let me know.&lt;/P&gt; 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Dec 2020 13:02:26 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-change-line-separator-for-csv-file-exported-from/m-p/27598#M19463</guid>
      <dc:creator>Nikhila</dc:creator>
      <dc:date>2020-12-24T13:02:26Z</dc:date>
    </item>
  </channel>
</rss>

