maropu commented on issue #24845: [SPARK-28097][SQL] Map ByteType to SMALLINT when using JDBC with PostgreSQL URL: https://github.com/apache/spark/pull/24845#issuecomment-507929409 `PostgresIntegrationSuite` can run `(DF → JDBC)` tests easily like this; ``` test("write byte as smallint") { sqlContext.createDataFrame(Seq((1.toByte, 2.toShort))) .write.jdbc(jdbcUrl, "byte_to_smallint_test", new Properties) val df = sqlContext.read.jdbc(jdbcUrl, "byte_to_smallint_test", new Properties) val schema = df.schema assert(schema(0).dataType == ShortType) assert(schema(1).dataType == ShortType) val rows = df.collect() assert(rows.length === 1) assert(rows(0).getShort(0) === 1) assert(rows(0).getShort(1) === 2) } ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
