@@ -83,6 +83,13 @@ class PostgresIntegrationSuite extends DockerJDBCIntegrationSuite {
8383 ).executeUpdate()
8484 conn.prepareStatement(" INSERT INTO char_types VALUES " +
8585 " ('abcd', 'efgh', 'ijkl', 'mnop', 'q')" ).executeUpdate()
86+
87+ conn.prepareStatement(" CREATE TABLE char_array_types (" +
88+ " c0 char(4)[], c1 character(4)[], c2 character varying(4)[], c3 varchar(4)[], c4 bpchar[])"
89+ ).executeUpdate()
90+ conn.prepareStatement(" INSERT INTO char_array_types VALUES " +
91+ """ ('{"a", "bcd"}', '{"ef", "gh"}', '{"i", "j", "kl"}', '{"mnop"}', '{"q", "r"}')"""
92+ ).executeUpdate()
8693 }
8794
8895 test(" Type mapping for various types" ) {
@@ -235,4 +242,16 @@ class PostgresIntegrationSuite extends DockerJDBCIntegrationSuite {
235242 assert(row(0 ).getString(3 ) === " mnop" )
236243 assert(row(0 ).getString(4 ) === " q" )
237244 }
245+
246+ test(" character array type tests" ) {
247+ val df = sqlContext.read.jdbc(jdbcUrl, " char_array_types" , new Properties )
248+ val row = df.collect()
249+ assert(row.length == 1 )
250+ assert(row(0 ).length === 5 )
251+ assert(row(0 ).getSeq[String ](0 ) === Seq (" a " , " bcd " ))
252+ assert(row(0 ).getSeq[String ](1 ) === Seq (" ef " , " gh " ))
253+ assert(row(0 ).getSeq[String ](2 ) === Seq (" i" , " j" , " kl" ))
254+ assert(row(0 ).getSeq[String ](3 ) === Seq (" mnop" ))
255+ assert(row(0 ).getSeq[String ](4 ) === Seq (" q" , " r" ))
256+ }
238257}
0 commit comments