Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/10928#discussion_r52953979
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/jdbc/PostgresDialect.scala ---
@@ -32,14 +32,18 @@ private object PostgresDialect extends JdbcDialect {
if (sqlType == Types.BIT && typeName.equals("bit") && size != 1) {
Some(BinaryType)
} else if (sqlType == Types.OTHER) {
- toCatalystType(typeName).filter(_ == StringType)
- } else if (sqlType == Types.ARRAY && typeName.length > 1 &&
typeName(0) == '_') {
- toCatalystType(typeName.drop(1)).map(ArrayType(_))
+ Some(StringType)
+ } else if (sqlType == Types.ARRAY) {
+ val scale = md.build.getLong("scale").toInt
+ // postgres array type names start with underscore
+ toCatalystType(typeName.drop(1), size, scale).map(ArrayType(_))
} else None
}
// TODO: support more type names.
- private def toCatalystType(typeName: String): Option[DataType] =
typeName match {
+ private def toCatalystType(typeName: String,
--- End diff --
This indentation is off. See
https://cwiki.apache.org/confluence/display/SPARK/Spark+Code+Style+Guide
Should be 4 spaces.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]