Skip to content

Commit 4266f4d

Browse files
committed
add StructField.toString back for backward compatibility
1 parent 3f49aab commit 4266f4d

File tree

1 file changed

+4
-1
lines changed
  • sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/types

1 file changed

+4
-1
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/types/dataTypes.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ object DataType {
7777
StructField(name, parseDataType(dataType), nullable, Metadata.fromJObject(metadata))
7878
}
7979

80-
@deprecated("Use DataType.fromJson instead")
80+
@deprecated("Use DataType.fromJson instead", "1.2.0")
8181
def fromCaseClassString(string: String): DataType = CaseClassStringParser(string)
8282

8383
private object CaseClassStringParser extends RegexParsers {
@@ -401,6 +401,9 @@ case class StructField(
401401
DataType.buildFormattedString(dataType, s"$prefix |", builder)
402402
}
403403

404+
// override the default toString to be compatible with legacy parquet files.
405+
override def toString: String = s"StructField($name,$dataType,$nullable)"
406+
404407
private[sql] def jsonValue: JValue = {
405408
("name" -> name) ~
406409
("type" -> dataType.jsonValue) ~

0 commit comments

Comments
 (0)