From 989a6b082884451269bee6995731d9e133a89e98 Mon Sep 17 00:00:00 2001 From: Jiatao Tao <245915794@qq.com> Date: Mon, 19 Aug 2019 14:20:28 +0800 Subject: [PATCH] #44, cast varchar/char as string when no precision. --- .../scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala index c6d21058e6f1e..a8455d30995bd 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala @@ -1757,7 +1757,9 @@ class AstBuilder(conf: SQLConf) extends SqlBaseBaseVisitor[AnyRef] with Logging case ("date", Nil) => DateType case ("timestamp", Nil) => TimestampType case ("string", Nil) => StringType + case ("char", Nil) => StringType case ("char", length :: Nil) => CharType(length.getText.toInt) + case ("varchar", Nil) => StringType case ("varchar", length :: Nil) => VarcharType(length.getText.toInt) case ("binary", Nil) => BinaryType case ("decimal", Nil) => DecimalType.USER_DEFAULT