shivsood commented on a change in pull request #25146: [SPARK-28152][SQL] 
Mapped ShortType to SMALLINT and FloatType to REAL for MsSqlServerDialect
URL: https://github.com/apache/spark/pull/25146#discussion_r303540891
 
 

 ##########
 File path: sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala
 ##########
 @@ -895,8 +895,20 @@ class JDBCSuite extends QueryTest
       "BIT")
     
assert(msSqlServerDialect.getJDBCType(BinaryType).map(_.databaseTypeDefinition).get
 ==
       "VARBINARY(MAX)")
+    
assert(msSqlServerDialect.getJDBCType(ShortType).map(_.databaseTypeDefinition).get
 ==
+      "SMALLINT")
   }
 
+  test("SPARK-28152 MsSqlServerDialect catalyst type mapping") {
+    val msSqlServerDialect = JdbcDialects.get("jdbc:sqlserver")
+    val metadata = new MetadataBuilder().putLong("scale", 1)
+    assert(msSqlServerDialect.getCatalystType(java.sql.Types.SMALLINT, 
"SMALLINT", 1,
+      metadata).get == ShortType)
+    assert(msSqlServerDialect.getCatalystType(java.sql.Types.REAL, "REAL", 1,
+      metadata).get == FloatType)
+  }
+
+
 
 Review comment:
   @dongjoon-hyun thanks for pointing out. Sorry that i missed this before. 
Fixed now.

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