[ https://issues.apache.org/jira/browse/SPARK-22441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16239143#comment-16239143 ]
Hongbo commented on SPARK-22441: -------------------------------- I also noticed that JDBC FLOAT maps to FloatType. I think it should map to DoubleType, too. {quote} MySQL docs say that "MySQL also treats REAL as a synonym for DOUBLE PRECISION." I haven't got a quick way to check, but I'd speculate that MySQL's JDBC connector advertises a MySQL REAL column as being of JDBC REAL type. {quote} In MySQL, even desc a table with a column defined as REAL, it will show double as its type. And in JDBC the return SQL type is DOUBLE, and the type name is also DOUBLE. So it doesn't break the specification. I'm not familiar with the reserve mapping. In my opinion, FloatType should map to Option(JdbcType("REAL", java.sql.Types.REAL)), according to the spec. {quote} The JDBC spec wasn't the reference for this implementation since a number of things it says about datatypes contradict the behaviour of actual databases. {quote} Yes, the real world and the spec are different, such as [SPARK-17195|https://issues.apache.org/jira/browse/SPARK-17195] However, are there any concrete cases related to REAL/FLOAT/DOUBLE that make us go against the specification? > JDBC REAL type is mapped to Double instead of Float > --------------------------------------------------- > > Key: SPARK-22441 > URL: https://issues.apache.org/jira/browse/SPARK-22441 > Project: Spark > Issue Type: Bug > Components: SQL > Affects Versions: 2.2.0 > Reporter: Hongbo > Priority: Minor > > In [JDBC > Specification|http://download.oracle.com/otn-pub/jcp/jdbc-4_1-mrel-eval-spec/jdbc4.1-fr-spec.pdf], > REAL should be mapped to Float. > But now, it's mapped to Double: > [https://github.com/apache/spark/blob/bc7ca9786e162e33f29d57c4aacb830761b97221/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala#L220] > Should it be changed according to the specification? -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org