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

    https://github.com/apache/spark/pull/15354#discussion_r85248522
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JacksonUtils.scala
 ---
    @@ -29,4 +31,28 @@ object JacksonUtils {
           case x => x != stopOn
         }
       }
    +
    +  /**
    +   * Verify if the schema is supported in JSON parsing.
    +   */
    +  def verifySchema(schema: StructType): Unit = {
    +    def verifyType(dataType: DataType): Unit = dataType match {
    +      case NullType | BooleanType | ByteType | ShortType | IntegerType | 
LongType | FloatType |
    +           DoubleType | StringType | TimestampType | DateType | BinaryType 
| _: DecimalType =>
    +
    +      case st: StructType => st.map(_.dataType).foreach(verifyType)
    +
    +      case at: ArrayType => verifyType(at.elementType)
    +
    +      case mt: MapType => verifyType(mt.keyType)
    +
    +      case udt: UserDefinedType[_] => verifyType(udt.sqlType)
    +
    +      case _ =>
    +        throw new UnsupportedOperationException(
    +          s"JSON conversion does not support to process 
${dataType.simpleString} type.")
    --- End diff --
    
    `does not support to process` is a little hard to parse.  Maybe `Unable to 
convert column ${name} of type ${dataType.simpleString} to JSON.`


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