Skip to content
This repository was archived by the owner on May 13, 2025. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add bit and default types
  • Loading branch information
dichiarafrancesco committed May 9, 2018
commit 3384333d52f3cd622eac8448167ce6ff40c5e6dc
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ private[redshift] class JDBCWrapper {
case java.sql.Types.TIMESTAMP => TimestampType

// Boolean Type
case java.sql.Types.BIT => BooleanType // @see JdbcDialect for quirks
case java.sql.Types.BOOLEAN => BooleanType

// Numeric Types
Expand All @@ -328,9 +329,11 @@ private[redshift] class JDBCWrapper {
case java.sql.Types.NUMERIC
if precision != 0 || scale != 0 => DecimalType(precision, scale)
case java.sql.Types.NUMERIC => DecimalType(38, 18) // Spark 1.5.0 default
// Redshift Real is represented in 4 bytes IEEE Float. https://docs.aws.amazon.com/redshift/latest/dg/r_Numeric_types201.html
case java.sql.Types.REAL => FloatType
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably want an inline comment to remind future reader Redshift Real is represented in 4 bytes IEEE Float. (it's a special snowflake because JDBC Real is usually 8 bytes IEEE float but PostgreSQL (thus Redshift because of lineage) treats Real differently.

case java.sql.Types.SMALLINT => IntegerType
case java.sql.Types.TINYINT => IntegerType
case _ => null
// scalastyle:on
}

Expand Down