sunxiaoguang commented on code in PR #49335:
URL: https://github.com/apache/spark/pull/49335#discussion_r1910380266


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/MySQLDialect.scala:
##########
@@ -112,6 +151,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"

Review Comment:
   This is the error for `SELECT CAST('123' AS LONGTEXT)`
   <img width="1075" alt="image" 
src="https://github.com/user-attachments/assets/2e9562cc-ede1-42de-bdd8-1864a2d8cf1f";
 />
   



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to