-
Notifications
You must be signed in to change notification settings - Fork 787
[GH-2419] Register Sedona functions as built-in functions to support permanent VIEW creation #2420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ package org.apache.sedona.sql.UDF | |
|
|
||
| import org.apache.spark.sql.{SQLContext, SparkSession, functions} | ||
| import org.apache.spark.sql.catalyst.FunctionIdentifier | ||
| import org.apache.spark.sql.catalyst.analysis.FunctionRegistry | ||
| import org.apache.spark.sql.catalyst.analysis.FunctionRegistry.FunctionBuilder | ||
| import org.apache.spark.sql.catalyst.expressions.{ExpectsInputTypes, Expression, ExpressionInfo, Literal} | ||
| import org.apache.spark.sql.expressions.Aggregator | ||
|
|
@@ -86,9 +87,20 @@ abstract class AbstractCatalog { | |
| functionIdentifier, | ||
| expressionInfo, | ||
| functionBuilder) | ||
| FunctionRegistry.builtin.registerFunction( | ||
| functionIdentifier, | ||
| expressionInfo, | ||
| functionBuilder) | ||
| } | ||
| aggregateExpressions.foreach { f => | ||
| sparkSession.udf.register(f.getClass.getSimpleName, functions.udaf(f)) | ||
| FunctionRegistry.builtin.registerFunction( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For folks in the industry who're using HiveMetastore, IcebergRestCatalog or other table metastore options: might be a good idea to leave an option open for them to register geospatial related udf with various metastore options if they prefer to do things that way (i.e. one draw back I could think of with having too many buildin func is it complicates the resolving path for every command, whether or not they contain geospatial udf). Don't have to do this in this PR, but might be great to have a tracking issue or TODO in some form.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @haizhou-zhao pleas feel free to create a github issue on Sedona and we can then track it |
||
| FunctionIdentifier(f.getClass.getSimpleName), | ||
| new ExpressionInfo(f.getClass.getCanonicalName, null, f.getClass.getSimpleName), | ||
| (_: Seq[Expression]) => | ||
| throw new UnsupportedOperationException( | ||
| s"Aggregate function ${f.getClass.getSimpleName} cannot be used as a regular function")) | ||
| } | ||
| aggregateExpressions.foreach(f => | ||
| sparkSession.udf.register(f.getClass.getSimpleName, functions.udaf(f))) | ||
| } | ||
|
|
||
| def dropAll(sparkSession: SparkSession): Unit = { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.