0
を使用して分割されたcsvファイル私はcsvファイルの次のスキーマを持っているスパーク - スカラ
(Id, OwnerUserId, CreationDate, ClosedDate, Score, Title, Body)
そして、私は使用してデータを分割したいと思います:
val splitComma = file.map(x => x.split (",")
val splitComma = file.map(x => x.split (",(?![^<>]*</>)(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)"))
それらの両方が動作しませんでした、以下は私のCSVファイルのサンプルです:
90,58,2008-08-01T14:41:24Z,2012-12-26T03:45:49Z,144,Good branching and merging tutorials for TortoiseSVN?,"<p>Are there any really good tutorials explaining <a href=""http://svnbook.red-bean.com/en/1.8/svn.branchmerge.html"" rel=""nofollow"">branching and merging</a> with Apache Subversion? </p>
<p>All the better if it's specific to TortoiseSVN client.</p>
"
120,83,2008-08-01T15:50:08Z,NA,21,ASP.NET Site Maps,"<p>Has anyone got experience creating <strong>SQL-based ASP.NET</strong> site-map providers?</p>
<p>I've got the default XML file <code>web.sitemap</code> working properly with my Menu and <strong>SiteMapPath</strong> controls, but I'll need a way for the users of my site to create and modify pages dynamically.</p>
<p>I need to tie page viewing permissions into the standard <code>ASP.NET</code> membership system as well.</p>
"
180,2089740,2008-08-01T18:42:19Z,NA,53,Function for creating color wheels,"<p>This is something I've pseudo-solved many times and never quite found a solution. That's stuck with me. The problem is to come up with a way to generate <code>N</code> colors, that are as distinguishable as possible where <code>N</code> is a parameter.</p>
"
これを使用する最も良い方法は何ですか?
'火花csv'ライブラリを使用してください。 '分割(「」)'は常にあなたは(1 『ライン』があるため、最後のフィールドを持つ複数の行に分割することができるという事実を無視し、CSVファイルに持っていますどのように多くの 『行』すべてのデータ –
のために動作しません。新しい行を含むHTMLのようなコンテンツ)? –