Skip to content

Commit

Permalink
Group functions by Spark SQL category
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaoguang Sun <[email protected]>
  • Loading branch information
sunxiaoguang committed Jan 8, 2025
1 parent 7dbe303 commit 1c27e03
Showing 1 changed file with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,42 +49,42 @@ private case class MySQLDialect() extends JdbcDialect with SQLConfHelper with No
// See https://dev.mysql.com/doc/refman/8.4/en/built-in-function-reference.html
// The functions listed here have the same signature and similar semantics,
// and can be supported with existing mechanism.
private val supportedSQLFunctions = Set(
private val supportedConditionalFunctions = Set ("COALESCE")
private val supportedDateAndTimestampFunctions = Set("DATE_ADD", "DATE_DIFF")
private val supportedEncryptionFunctions = Set("SHA1", "SHA2", "MD5")
private val supportedMathmaticalFunctions = Set (
"ABS",
"COALESCE",
"ACOS",
"ASIN",
"ATAN",
"ATAN2",
"COS",
"COT",
"CRC32",
"DEGREES",
"EXP",
"GREATEST",
"LEAST",
"RAND",
"LN",
"LOG10",
"LOG2",
"LN",
"EXP",
"POWER",
"SQRT",
"SIN",
"COS",
"TAN",
"COT",
"ASIN",
"ACOS",
"ATAN",
"ATAN2",
"DEGREES",
"RADIANS",
"RAND",
"SIGN",
"SUBSTRING",
"UPPER",
"LOWER",
"SHA1",
"SHA2",
"MD5",
"CRC32",
"BIT_LENGTH",
"CHAR_LENGTH",
"CONCAT")
"SQRT",
"SIN",
"TAN")
private val supportedStringFunctions =
Set("BIT_LENGTH", "CHAR_LENGTH", "CONCAT", "LOWER", "SUBSTRING", "UPPER")

private val supportedFunctions =
supportedAggregateFunctions ++ Set("DATE_ADD", "DATE_DIFF") ++ supportedSQLFunctions
supportedAggregateFunctions ++
supportedConditionalFunctions ++
supportedDateAndTimestampFunctions ++
supportedEncryptionFunctions ++
supportedMathmaticalFunctions ++
supportedStringFunctions

override def isSupportedFunction(funcName: String): Boolean =
supportedFunctions.contains(funcName)
Expand Down

0 comments on commit 1c27e03

Please sign in to comment.