Skip to content

Commit

Permalink
add StructField.toString back for backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mengxr committed Oct 15, 2014
1 parent 3f49aab commit 4266f4d
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ object DataType {
StructField(name, parseDataType(dataType), nullable, Metadata.fromJObject(metadata))
}

@deprecated("Use DataType.fromJson instead")
@deprecated("Use DataType.fromJson instead", "1.2.0")
def fromCaseClassString(string: String): DataType = CaseClassStringParser(string)

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

// override the default toString to be compatible with legacy parquet files.
override def toString: String = s"StructField($name,$dataType,$nullable)"

private[sql] def jsonValue: JValue = {
("name" -> name) ~
("type" -> dataType.jsonValue) ~
Expand Down

0 comments on commit 4266f4d

Please sign in to comment.