Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16976#discussion_r102664832
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/csv/CSVFileFormat.scala
 ---
    @@ -43,23 +37,26 @@ class CSVFileFormat extends TextBasedFileFormat with 
DataSourceRegister {
     
       override def shortName(): String = "csv"
     
    -  override def toString: String = "CSV"
    -
    -  override def hashCode(): Int = getClass.hashCode()
    -
    -  override def equals(other: Any): Boolean = 
other.isInstanceOf[CSVFileFormat]
    +  override def isSplitable(
    +      sparkSession: SparkSession,
    +      options: Map[String, String],
    +      path: Path): Boolean = {
    +    val parsedOptions =
    +      new CSVOptions(options, 
sparkSession.sessionState.conf.sessionLocalTimeZone)
    +    val csvDataSource = CSVDataSource(parsedOptions)
    +    csvDataSource.isSplitable && super.isSplitable(sparkSession, options, 
path)
    +  }
     
       override def inferSchema(
           sparkSession: SparkSession,
           options: Map[String, String],
           files: Seq[FileStatus]): Option[StructType] = {
         require(files.nonEmpty, "Cannot infer schema from an empty set of 
files")
    --- End diff --
    
    I think returning `None` is better, the upper-level will handle it and 
throw exception


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to