Skip to content

Commit

Permalink
[SPARK-33292][SQL] Make Literal ArrayBasedMapData string representati…
Browse files Browse the repository at this point in the history
…on disambiguous
  • Loading branch information
dongjoon-hyun committed Oct 29, 2020
1 parent cbd3fde commit 0fea5a9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ case class Literal (value: Any, dataType: DataType) extends LeafExpression {
override def toString: String = value match {
case null => "null"
case binary: Array[Byte] => s"0x" + DatatypeConverter.printHexBinary(binary)
case d: ArrayBasedMapData => s"map(${d.toString})"
case other => other.toString
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ class LiteralExpressionSuite extends SparkFunSuite with ExpressionEvalHelper {
}
checkMapLiteral(Map("a" -> 1, "b" -> 2, "c" -> 3))
checkMapLiteral(Map("1" -> 1.0, "2" -> 2.0, "3" -> 3.0))
assert(Literal.create(Map("a" -> 1)).toString === "map(keys: [a], values: [1])")
}

test("struct") {
Expand Down

0 comments on commit 0fea5a9

Please sign in to comment.