wayneguow commented on code in PR #49564:
URL: https://github.com/apache/spark/pull/49564#discussion_r1929496676


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/MySQLDialect.scala:
##########
@@ -406,7 +406,7 @@ private case class MySQLDialect() extends JdbcDialect with 
SQLConfHelper with No
       }
 
       options.prepareQuery +
-        s"SELECT $columnList FROM ${options.tableOrQuery} $tableSampleClause" +
+        s"SELECT ${options.hint}$columnList FROM ${options.tableOrQuery} 
$tableSampleClause" +

Review Comment:
   > is there an spec to say that the "HINT" could only appear in the SELECT 
clause?
   
   @pan3793 Currently `hints` are not a standard feature defined in the 
`ANSI/ISO` SQL standards, so there is no an spec for `hints`.
   
   However, in current mainstream DBMS and Spark(mentioned by @dongjoon-hyun) , 
the definition of the `hints` feature is basically required to follow keywords 
such as `SELECT`:
   
   - Oracle: 
https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/Comments.html
       <img width="661" alt="image" 
src="https://github.com/user-attachments/assets/fdf22e48-bc56-4347-995d-2b175ec74020";
 />
   
   - MySQL: https://dev.mysql.com/doc/refman/8.4/en/optimizer-hints.html
       <img width="932" alt="image" 
src="https://github.com/user-attachments/assets/6a8ed91c-991a-414a-8896-cf403027ff0b";
 />
   
   - 
Databricks:https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-qry-select.html
       <img width="710" alt="image" 
src="https://github.com/user-attachments/assets/9bd21b2e-5c9b-471f-b552-6bd2352ac1a8";
 />



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