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

    https://github.com/apache/spark/pull/21667#discussion_r199863349
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/json/JsonFileFormat.scala
 ---
    @@ -148,6 +144,28 @@ class JsonFileFormat extends TextBasedFileFormat with 
DataSourceRegister {
       override def hashCode(): Int = getClass.hashCode()
     
       override def equals(other: Any): Boolean = 
other.isInstanceOf[JsonFileFormat]
    +
    +  override def validateDataType(dataType: DataType, isReadPath: Boolean): 
Unit = dataType match {
    --- End diff --
    
    how about
    
    ```
    the base class
    def validateDataType(dataType: DataType, isReadPath: Boolean): Boolean = 
dataType match {
      case BooleanType | ByteType | ShortType | IntegerType | LongType | 
FloatType | DoubleType |
        StringType | BinaryType | DateType | TimestampType | _: DecimalType => 
true
      case _ => false
    }
    
    json
    override def validateDataType(dataType: DataType, isReadPath: Boolean): 
Boolean = {
      case st: StructType => st.forall { f => validateDataType(f.dataType, 
isReadPath) }
      case ArrayType...
      ...
      case other => super.validateDataType(other)
    }
    
    
    ```


---

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

Reply via email to