You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ya...@apache.org on 2020/08/10 10:10:01 UTC
[spark] branch branch-3.0 updated:
[SPARK-32576][SQL][TEST][FOLLOWUP] Add tests for all the character array
types in PostgresIntegrationSuite
This is an automated email from the ASF dual-hosted git repository.
yamamuro pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new 843ff03 [SPARK-32576][SQL][TEST][FOLLOWUP] Add tests for all the character array types in PostgresIntegrationSuite
843ff03 is described below
commit 843ff0367e45034bfc1e174a939f336bcc8d2391
Author: Takeshi Yamamuro <ya...@apache.org>
AuthorDate: Mon Aug 10 19:05:50 2020 +0900
[SPARK-32576][SQL][TEST][FOLLOWUP] Add tests for all the character array types in PostgresIntegrationSuite
### What changes were proposed in this pull request?
This is a follow-up PR of #29192 that adds integration tests for character arrays in `PostgresIntegrationSuite`.
### Why are the changes needed?
For better test coverage.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Add tests.
Closes #29397 from maropu/SPARK-32576-FOLLOWUP.
Authored-by: Takeshi Yamamuro <ya...@apache.org>
Signed-off-by: Takeshi Yamamuro <ya...@apache.org>
(cherry picked from commit 7990ea14090c13e1fd1e42bc519b54144bd3aa76)
Signed-off-by: Takeshi Yamamuro <ya...@apache.org>
---
.../spark/sql/jdbc/PostgresIntegrationSuite.scala | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/PostgresIntegrationSuite.scala b/external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/PostgresIntegrationSuite.scala
index 1914491..2b676be 100644
--- a/external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/PostgresIntegrationSuite.scala
+++ b/external/docker-integration-tests/src/test/scala/org/apache/spark/sql/jdbc/PostgresIntegrationSuite.scala
@@ -84,6 +84,13 @@ class PostgresIntegrationSuite extends DockerJDBCIntegrationSuite {
).executeUpdate()
conn.prepareStatement("INSERT INTO char_types VALUES " +
"('abcd', 'efgh', 'ijkl', 'mnop', 'q')").executeUpdate()
+
+ conn.prepareStatement("CREATE TABLE char_array_types (" +
+ "c0 char(4)[], c1 character(4)[], c2 character varying(4)[], c3 varchar(4)[], c4 bpchar[])"
+ ).executeUpdate()
+ conn.prepareStatement("INSERT INTO char_array_types VALUES " +
+ """('{"a", "bcd"}', '{"ef", "gh"}', '{"i", "j", "kl"}', '{"mnop"}', '{"q", "r"}')"""
+ ).executeUpdate()
}
test("Type mapping for various types") {
@@ -236,4 +243,16 @@ class PostgresIntegrationSuite extends DockerJDBCIntegrationSuite {
assert(row(0).getString(3) === "mnop")
assert(row(0).getString(4) === "q")
}
+
+ test("SPARK-32576: character array type tests") {
+ val df = sqlContext.read.jdbc(jdbcUrl, "char_array_types", new Properties)
+ val row = df.collect()
+ assert(row.length == 1)
+ assert(row(0).length === 5)
+ assert(row(0).getSeq[String](0) === Seq("a ", "bcd "))
+ assert(row(0).getSeq[String](1) === Seq("ef ", "gh "))
+ assert(row(0).getSeq[String](2) === Seq("i", "j", "kl"))
+ assert(row(0).getSeq[String](3) === Seq("mnop"))
+ assert(row(0).getSeq[String](4) === Seq("q", "r"))
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org