anchovYu commented on code in PR #43612: URL: https://github.com/apache/spark/pull/43612#discussion_r1379437089
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/literals.scala: ########## @@ -247,6 +251,67 @@ object Literal { s"Literal must have a corresponding value to ${dataType.catalogString}, " + s"but class ${Utils.getSimpleName(value.getClass)} found.") } + + /** + * Parse and analyze the .sql string of a Literal, construct the Literal given the data type json. + * Example usage: + * val serializedValue = lit.sql + * val dataTypeJson = lit.dataType.json + * val deserializedLit: Literal = Literal.fromSQL(serializedValue, dataTypeJson) + * + * @param valueSqlStr the .sql string of the Literal + * @param dataTypeJson the json format data type of the Literal + * @throws AnalysisException INVALID_LITERAL_VALUE_SQL_STRING_FOR_DESERIALIZATION + */ + private[sql] def fromSQL(valueSqlStr: String, dataTypeJson: String): Literal = { Review Comment: DDL does not preserves those `containsNull` fields while json does. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org