title: Spark DataFrame handing empty String in OneHotEncoder
body: <p>I am importing a CSV file (using spark-csv) into a <code>DataFrame</code> which has empty <code>String</code> values. When applied the <code>OneHotEncoder</code>, the application crashes with error <code>requirement failed: Cannot have an empty string for name.</code>. Is there a way I can get around this? </p>
  
  <p>I could reproduce the error in the <a href="https://spark.apache.org/docs/latest/ml-features.html#onehotencoder" rel="nofollow">example provided on Spark ml</a> page:</p>
  
  <pre><code>val df = sqlContext.createDataFrame(Seq(
    (0, "a"),
    (1, "b"),
    (2, "c"),
    (3, ""),         //&lt;- original example has "a" here
    (4, "a"),
    (5, "c")
  )).toDF("id", "category")
  
  val indexer = new StringIndexer()
    .setInputCol("category")
    .setOutputCol("categoryIndex")
    .fit(df)
  val indexed = indexer.transform(df)
  
  val encoder = new OneHotEncoder()
    .setInputCol("categoryIndex")
    .setOutputCol("categoryVec")
  val encoded = encoder.transform(indexed)
  
  encoded.show()
  </code></pre>
  
  <p>It is annoying since missing/empty values is a highly generic case.</p>
  
  <p>Thanks in advance,
  Nikhil</p>