Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17406#discussion_r108050303
  
    --- Diff: 
sql/catalyst/src/test/scala/org/apache/spark/sql/types/DataTypeSuite.scala ---
    @@ -169,30 +169,45 @@ class DataTypeSuite extends SparkFunSuite {
         assert(!arrayType.existsRecursively(_.isInstanceOf[IntegerType]))
       }
     
    -  def checkDataTypeJsonRepr(dataType: DataType): Unit = {
    -    test(s"JSON - $dataType") {
    +  def checkDataTypeFromJson(dataType: DataType): Unit = {
    +    test(s"from Json - $dataType") {
           assert(DataType.fromJson(dataType.json) === dataType)
         }
       }
     
    -  checkDataTypeJsonRepr(NullType)
    -  checkDataTypeJsonRepr(BooleanType)
    -  checkDataTypeJsonRepr(ByteType)
    -  checkDataTypeJsonRepr(ShortType)
    -  checkDataTypeJsonRepr(IntegerType)
    -  checkDataTypeJsonRepr(LongType)
    -  checkDataTypeJsonRepr(FloatType)
    -  checkDataTypeJsonRepr(DoubleType)
    -  checkDataTypeJsonRepr(DecimalType(10, 5))
    -  checkDataTypeJsonRepr(DecimalType.SYSTEM_DEFAULT)
    -  checkDataTypeJsonRepr(DateType)
    -  checkDataTypeJsonRepr(TimestampType)
    -  checkDataTypeJsonRepr(StringType)
    -  checkDataTypeJsonRepr(BinaryType)
    -  checkDataTypeJsonRepr(ArrayType(DoubleType, true))
    -  checkDataTypeJsonRepr(ArrayType(StringType, false))
    -  checkDataTypeJsonRepr(MapType(IntegerType, StringType, true))
    -  checkDataTypeJsonRepr(MapType(IntegerType, ArrayType(DoubleType), false))
    +  def checkDataTypeFromDDL(dataType: DataType): Unit = {
    +    test(s"from DDL - $dataType") {
    +      assert(DataType.fromDDL(s"a ${dataType.sql}") === new 
StructType().add("a", dataType))
    +    }
    +  }
    +
    +  def checkDataTypeFromText(dataType: DataType): Unit = {
    +    checkDataTypeFromJson(dataType)
    +    checkDataTypeFromDDL(dataType)
    +  }
    +
    +  // In some types, check json formats only because the types do not 
support DDL formats.
    --- End diff --
    
    In Spark SQL, we do not enforce nullability. It is like a hint for 
optimization. Not supporting such an syntax is reasonable.


---
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