File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
main/scala/org/apache/spark/sql/hive
test/scala/org/apache/spark/sql/hive Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -390,6 +390,7 @@ object HiveMetastoreTypes extends RegexParsers {
390390 case d : DecimalType => HiveShim .decimalMetastoreString(d)
391391 case TimestampType => " timestamp"
392392 case NullType => " void"
393+ case udt : UserDefinedType [_] => toMetastoreType(udt.sqlType)
393394 }
394395}
395396
Original file line number Diff line number Diff line change @@ -19,7 +19,8 @@ package org.apache.spark.sql.hive
1919
2020import org .scalatest .FunSuite
2121
22- import org .apache .spark .sql .catalyst .types .{DataType , StructType }
22+ import org .apache .spark .sql .catalyst .types .StructType
23+ import org .apache .spark .sql .test .ExamplePointUDT
2324
2425class HiveMetastoreCatalogSuite extends FunSuite {
2526
@@ -29,4 +30,10 @@ class HiveMetastoreCatalogSuite extends FunSuite {
2930 val datatype = HiveMetastoreTypes .toDataType(metastr)
3031 assert(datatype.isInstanceOf [StructType ])
3132 }
33+
34+ test(" udt to metastore type conversion" ) {
35+ val udt = new ExamplePointUDT
36+ assert(HiveMetastoreTypes .toMetastoreType(udt) ===
37+ HiveMetastoreTypes .toMetastoreType(udt.sqlType))
38+ }
3239}
You can’t perform that action at this time.
0 commit comments