Skip to content

Commit 8753610

Browse files
author
Jacky Li
committed
fix bug
1 parent e5a722d commit 8753610

File tree

4 files changed

+18
-100
lines changed

4 files changed

+18
-100
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@ class Analyzer(catalog: Catalog,
4545
maxIterations: Int = 100)
4646
extends RuleExecutor[LogicalPlan] with HiveTypeCoercion {
4747

48-
val resolver = if (conf.getConf(CatalystConf.CASE_SENSITIVE, "true").toBoolean) {
49-
caseSensitiveResolution
50-
} else {
51-
caseInsensitiveResolution
52-
}
48+
def resolver: Resolver = {
49+
if (conf.getConf(CatalystConf.CASE_SENSITIVE, "true").toBoolean) {
50+
caseSensitiveResolution
51+
} else {
52+
caseInsensitiveResolution
53+
}
54+
}
5355

5456
val fixedPoint = FixedPoint(maxIterations)
5557

sql/core/src/main/scala/org/apache/spark/sql/test/TestCaseInsensitiveSQLContext.scala

Lines changed: 0 additions & 38 deletions
This file was deleted.

sql/core/src/test/scala/org/apache/spark/sql/SQLQueryCaseInsensitiveSuite.scala

Lines changed: 0 additions & 55 deletions
This file was deleted.

sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ package org.apache.spark.sql
1919

2020
import java.util.TimeZone
2121

22-
import org.scalatest.BeforeAndAfterAll
23-
2422
import org.apache.spark.sql.catalyst.errors.TreeNodeException
2523
import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
24+
import org.apache.spark.sql.catalyst.CatalystConf
25+
import org.scalatest.BeforeAndAfterAll
2626

2727
/* Implicits */
2828
import org.apache.spark.sql.TestData._
@@ -1012,4 +1012,13 @@ class SQLQuerySuite extends QueryTest with BeforeAndAfterAll {
10121012
rdd.registerTempTable("distinctData")
10131013
checkAnswer(sql("SELECT COUNT(DISTINCT key,value) FROM distinctData"), 2)
10141014
}
1015+
1016+
test("SPARK-4699 case sensitivity SQL query") {
1017+
setConf(CatalystConf.CASE_SENSITIVE, "false")
1018+
val data = TestData(1,"val_1") :: TestData(2,"val_2") :: Nil
1019+
val rdd = sparkContext.parallelize((0 to 1).map(i => data(i)))
1020+
rdd.registerTempTable("testTable1")
1021+
checkAnswer(sql("SELECT VALUE FROM TESTTABLE1 where KEY = 1"), "val_1")
1022+
setConf(CatalystConf.CASE_SENSITIVE, "true")
1023+
}
10151024
}

0 commit comments

Comments
 (0)