title: Dataframe filtered by one column's split length
body: <p>I started to learn Scala on spark and try to do ETL.
  I try to filter data frames whose string should be split into 4 columns by whitespace family.</p>
  
  <p>This is what I have tried</p>
  
  <pre><code>df.where(split(df("item"), "\\s+").length == 4).show()
  </code></pre>
  
  <p>And it shows the error <code>value length is not a member of org.apache.spark.sql.Column</code></p>
  
  <p>and I have looked the <a href="https://spark.apache.org/docs/2.2.0/api/scala/index.html#org.apache.spark.sql.Column" rel="nofollow noreferrer">documentation</a> and find that it returns the Column class so it definitely doesn't have the length attribute.</p>
  
  <p>And I am stuck on it and doesn't know how to solve it, I have googled it but only find <a href="https://stackoverflow.com/questions/39255973/split-1-column-into-3-columns-in-spark-scala">this</a>.</p>
  
  <p>What I want is to filter based on the split length and I also try to <a href="https://www.scala-lang.org/api/current/scala/collection/immutable/StringOps.html?search=split" rel="nofollow noreferrer">lookup</a> what split return but I don't know which split function is used.</p>
  
  <p>So could you please tell me</p>
  
  <p>1.What the split function it used?</p>
  
  <p>2.How to filter rows with split string's length is 4?</p>
  
  <p>Thanks</p>