shivsood opened a new pull request #25146: Fix for SPARK-28152: ShortType and 
FloatTypes are not mapped correctly for read/write of SQLServer Tables
URL: https://github.com/apache/spark/pull/25146
 
 
   ShortType and FloatTypes are not correctly mapped to right JDBC types when 
using JDBC connector. This results in tables and
   spark data frame being created with unintended types. The issue was observed 
when validating against SQLServer.
   
   Some example issue
       - Write from df with column type results in a SQL table of with column 
type as INTEGER as opposed to SMALLINT.
         Thus a larger table that expected.
       - Read results in a dataframe with type INTEGER as opposed to ShortType
   
   FloatTypes have a issue with read path. In the write path Spark data type 
'FloatType' is correctly mapped to JDBC equivalent data type 'Real'. But in the 
read path when JDBC data types need to be converted to Catalyst data types ( 
getCatalystType) 'Real' gets incorrectly gets mapped to 'DoubleType' rather 
than 'FloatType'.
   
   ## What changes were proposed in this pull request?
   Correct mappings added to MsSqlServerDialect.scala. ShortType is mapped to 
SMALLINT and FloatType is mapped to REAL
   
   (Please fill in changes proposed in this fix)
   
   ## How was this patch tested?
   UnitTest added in JDBCSuite.scala and these were tested.
   Integration test updated and passed in MsSqlServerDialect.scala 
   E2E test done with SQLServer
   
   (Please explain how this patch was tested. E.g. unit tests, integration 
tests, manual tests)
   (If this patch involves UI changes, please attach a screenshot; otherwise, 
remove this)
   
   Please review https://spark.apache.org/contributing.html before opening a 
pull request.
   

----------------------------------------------------------------
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]

Reply via email to