Skip to content

Commit 60336e3

Browse files
scwfmarmbrus
authored andcommitted
[SPARK-7656] [SQL] use CatalystConf in FunctionRegistry
follow up for apache#5806 Author: scwf <[email protected]> Closes apache#6164 from scwf/FunctionRegistry and squashes the following commits: 15e6697 [scwf] use catalogconf in FunctionRegistry
1 parent 3860520 commit 60336e3

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package org.apache.spark.sql.catalyst.analysis
1919

20+
import org.apache.spark.sql.catalyst.CatalystConf
2021
import org.apache.spark.sql.catalyst.expressions.Expression
2122
import scala.collection.mutable
2223

@@ -28,12 +29,12 @@ trait FunctionRegistry {
2829

2930
def lookupFunction(name: String, children: Seq[Expression]): Expression
3031

31-
def caseSensitive: Boolean
32+
def conf: CatalystConf
3233
}
3334

3435
trait OverrideFunctionRegistry extends FunctionRegistry {
3536

36-
val functionBuilders = StringKeyHashMap[FunctionBuilder](caseSensitive)
37+
val functionBuilders = StringKeyHashMap[FunctionBuilder](conf.caseSensitiveAnalysis)
3738

3839
override def registerFunction(name: String, builder: FunctionBuilder): Unit = {
3940
functionBuilders.put(name, builder)
@@ -44,8 +45,9 @@ trait OverrideFunctionRegistry extends FunctionRegistry {
4445
}
4546
}
4647

47-
class SimpleFunctionRegistry(val caseSensitive: Boolean) extends FunctionRegistry {
48-
val functionBuilders = StringKeyHashMap[FunctionBuilder](caseSensitive)
48+
class SimpleFunctionRegistry(val conf: CatalystConf) extends FunctionRegistry {
49+
50+
val functionBuilders = StringKeyHashMap[FunctionBuilder](conf.caseSensitiveAnalysis)
4951

5052
override def registerFunction(name: String, builder: FunctionBuilder): Unit = {
5153
functionBuilders.put(name, builder)
@@ -69,7 +71,7 @@ object EmptyFunctionRegistry extends FunctionRegistry {
6971
throw new UnsupportedOperationException
7072
}
7173

72-
override def caseSensitive: Boolean = throw new UnsupportedOperationException
74+
override def conf: CatalystConf = throw new UnsupportedOperationException
7375
}
7476

7577
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class SQLContext(@transient val sparkContext: SparkContext)
121121

122122
// TODO how to handle the temp function per user session?
123123
@transient
124-
protected[sql] lazy val functionRegistry: FunctionRegistry = new SimpleFunctionRegistry(true)
124+
protected[sql] lazy val functionRegistry: FunctionRegistry = new SimpleFunctionRegistry(conf)
125125

126126
@transient
127127
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
@@ -357,7 +357,7 @@ class HiveContext(sc: SparkContext) extends SQLContext(sc) {
357357
@transient
358358
override protected[sql] lazy val functionRegistry =
359359
new HiveFunctionRegistry with OverrideFunctionRegistry {
360-
def caseSensitive: Boolean = false
360+
override def conf: CatalystConf = currentSession().conf
361361
}
362362

363363
/* An analyzer that uses the Hive metastore. */

0 commit comments

Comments
 (0)