uros-b commented on code in PR #57564:
URL: https://github.com/apache/spark/pull/57564#discussion_r3657947529
##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -525,6 +535,16 @@ abstract class JdbcDialect extends Serializable with
Logging {
}
}
+ /**
+ * Truncates `expr` toward zero, so that a cast from a fractional type to an
integral type that
+ * is pushed down matches Spark, which truncates rather than rounds.
Dialects for databases that
+ * round such casts override this with the database's truncating function.
The default returns
+ * `expr` unchanged, for databases whose cast already truncates like Spark.
+ * @param expr The SQL string of the value being cast.
+ * @return The SQL string to cast instead of `expr`.
+ */
+ def truncateFractionalValue(expr: String): String = expr
Review Comment:
JdbcDialect is `@DeveloperApi`, so a breaking change is technically
permitted, but the established practice for this trait is to add new hooks as
concrete methods with a safe default (e.g. see getFetchSize,
isSyntaxErrorBestEffort, isObjectNotFoundException,
isNotSelectableObjectException). So yeah, keep the deafult and just add
`@Since("4.3.0")` if you're targeting the last 4.x version (or 5.0.0 if you're
targeting master only).
--
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]