Skip to content

Commit 2ca8459

Browse files
remove the OverrideFunctionRegistry
1 parent 1cb2629 commit 2ca8459

File tree

3 files changed

+2
-16
lines changed

3 files changed

+2
-16
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,6 @@ trait FunctionRegistry {
3535
def lookupFunction(name: String, children: Seq[Expression]): Expression
3636
}
3737

38-
class OverrideFunctionRegistry(underlying: FunctionRegistry) extends FunctionRegistry {
39-
40-
private val functionBuilders = StringKeyHashMap[FunctionBuilder](caseSensitive = false)
41-
42-
override def registerFunction(name: String, builder: FunctionBuilder): Unit = {
43-
functionBuilders.put(name, builder)
44-
}
45-
46-
override def lookupFunction(name: String, children: Seq[Expression]): Expression = {
47-
functionBuilders.get(name).map(_(children)).getOrElse(underlying.lookupFunction(name, children))
48-
}
49-
}
50-
5138
class SimpleFunctionRegistry extends FunctionRegistry {
5239

5340
private val functionBuilders = StringKeyHashMap[FunctionBuilder](caseSensitive = false)

sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@ class SQLContext(@transient val sparkContext: SparkContext)
139139

140140
// TODO how to handle the temp function per user session?
141141
@transient
142-
protected[sql] lazy val functionRegistry: FunctionRegistry =
143-
new OverrideFunctionRegistry(FunctionRegistry.builtin)
142+
protected[sql] lazy val functionRegistry: FunctionRegistry = FunctionRegistry.builtin
144143

145144
@transient
146145
protected[sql] lazy val analyzer: Analyzer =

sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveContext.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ class HiveContext(sc: SparkContext) extends SQLContext(sc) {
371371
// Note that HiveUDFs will be overridden by functions registered in this context.
372372
@transient
373373
override protected[sql] lazy val functionRegistry: FunctionRegistry =
374-
new OverrideFunctionRegistry(new HiveFunctionRegistry(FunctionRegistry.builtin))
374+
new HiveFunctionRegistry(FunctionRegistry.builtin)
375375

376376
/* An analyzer that uses the Hive metastore. */
377377
@transient

0 commit comments

Comments
 (0)