sunxiaoguang commented on code in PR #49453:
URL: https://github.com/apache/spark/pull/49453#discussion_r1914395305
##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/MySQLDialect.scala:
##########
@@ -112,6 +112,19 @@ private case class MySQLDialect() extends JdbcDialect with
SQLConfHelper with No
} else {
super.visitAggregateFunction(funcName, isDistinct, inputs)
}
+
+ override def visitCast(expr: String, exprDataType: DataType, dataType:
DataType): String = {
+ val databaseTypeDefinition = dataType match {
+ // MySQL uses CHAR in the cast function for the type LONGTEXT
+ case StringType => "CHAR"
+ // MySQL uses SIGNED INTEGER in the cast function for the types
SMALLINT, INTEGER and BIGINT
+ case ShortType | IntegerType | LongType => "SIGNED INTEGER"
Review Comment:
I see, there are so many details underlying which I don't know yet. If there
are dependencies on the metadata of resultset, it looks like we can't support
cast to Short and Integer anymore. How about we remove these two types and
leave them not supported at this time, what do you think?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]