Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/6710#discussion_r32049326
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala
---
@@ -32,9 +38,94 @@ trait FunctionRegistry {
def conf: CatalystConf
}
+
+object FunctionRegistry {
+
+ type FunctionBuilder = Seq[Expression] => Expression
+
+ val expressions: Map[String, FunctionBuilder] = Map(
+ // Non aggregate functions
+ expression[Abs]("abs"),
+ expression[CreateArray]("array"),
+ expression[Coalesce]("coalesce"),
+ expression[Explode]("explode"),
+ expression[Lower]("lower"),
+ expression[Substring]("substr"),
+ expression[Substring]("substring"),
+ expression[Rand]("rand"),
+ expression[Randn]("randn"),
+ expression[CreateStruct]("struct"),
+ expression[Sqrt]("sqrt"),
+ expression[Upper]("upper"),
+
+ // Math functions
+ expression[Acos]("acos"),
+ expression[Asin]("asin"),
+ expression[Atan]("atan"),
+ expression[Atan2]("atan2"),
+ expression[Cbrt]("cbrt"),
+ expression[Ceil]("ceil"),
+ expression[Cos]("cos"),
+ expression[Exp]("exp"),
+ expression[Expm1]("expm1"),
+ expression[Floor]("floor"),
+ expression[Hypot]("hypot"),
+ expression[Log]("log"),
+ expression[Log10]("log10"),
+ expression[Log1p]("log1p"),
+ expression[Pow]("pow"),
+ expression[Rint]("rint"),
+ expression[Signum]("signum"),
+ expression[Sin]("sin"),
+ expression[Sinh]("sinh"),
+ expression[Tan]("tan"),
+ expression[Tanh]("tanh"),
+ expression[ToDegrees]("todegrees"),
+ expression[ToRadians]("toradians"),
+
+ // aggregate functions
+ expression[Average]("avg"),
+ expression[Count]("count"),
+ expression[First]("first"),
+ expression[Last]("last"),
+ expression[Max]("max"),
+ expression[Min]("min"),
+ expression[Sum]("sum")
+ )
+
+ /** See usage above. */
+ private def expression[T <: Expression](name: String)
--- End diff --
no they are not always the same, e.g. "avg" vs "Average".
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]