Hyukjin Kwon created SPARK-13137:
------------------------------------

             Summary: NullPoingException in schema inference for CSV when the 
first line is empty
                 Key: SPARK-13137
                 URL: https://issues.apache.org/jira/browse/SPARK-13137
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 2.0.0
            Reporter: Hyukjin Kwon


When the first line is empty and it tries to infer schema, this emits the 
exception below:

{code}
java.lang.NullPointerException was thrown.
java.lang.NullPointerException
        at 
scala.collection.mutable.ArrayOps$ofRef$.length$extension(ArrayOps.scala:114)
        at scala.collection.mutable.ArrayOps$ofRef.length(ArrayOps.scala:114)
        at 
scala.collection.IndexedSeqOptimized$class.zipWithIndex(IndexedSeqOptimized.scala:93)
        at 
scala.collection.mutable.ArrayOps$ofRef.zipWithIndex(ArrayOps.scala:108)
        at 
org.apache.spark.sql.execution.datasources.csv.CSVRelation.inferSchema(CSVRelation.scala:137)
        at 
org.apache.spark.sql.execution.datasources.csv.CSVRelation.dataSchema$lzycompute(CSVRelation.scala:50)
        at 
org.apache.spark.sql.execution.datasources.csv.CSVRelation.dataSchema(CSVRelation.scala:48)
        at 
org.apache.spark.sql.sources.HadoopFsRelation.schema$lzycompute(interfaces.scala:666)
        at 
org.apache.spark.sql.sources.HadoopFsRelation.schema(interfaces.scala:665)
        at 
org.apache.spark.sql.execution.datasources.LogicalRelation.<init>(LogicalRelation.scala:39)
        at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:115)
        at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:125)
{code}

This looks because it fails to skip the empty lines in {{findFirstLine()}} at 
{{CSVRelation}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to