-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-4699] [SQL] Make caseSensitive configurable in spark sql analyzer #5806
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
Closed
Closed
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
578d167
make caseSensitive configurable
f57f15c
add testcase
91b1b96
make caseSensitive configurable in Analyzer
e7bca31
make caseSensitive configuration in Analyzer and Catalog
fcbf0d9
fix scalastyle check
6332e0f
fix bug
005c56d
make SQLContext caseSensitivity configurable
9bf4cc7
fix bug in catalyst
73c16b1
fix bug in sql/hive
05b09a3
fix conflict base on the latest master branch
dee56e9
fix test case failure
39e369c
fix confilct after DataFrame PR
12eca9a
solve conflict with master
664d1e9
Merge branch 'master' of https://github.com/apache/spark into case
56034ca
fix conflicts and improve for catalystconf
scwf 5472b08
fix compile issue
scwf 69b3b70
fix AnalysisSuite
scwf fd30e25
added override
scwf 966e719
set CASE_SENSITIVE false in hivecontext
scwf 5d7c456
set CASE_SENSITIVE false in TestHive
scwf 6ef31cf
revert pom changes
scwf eee75ba
fix EmptyConf
scwf d5a9933
fix style
scwf 7fc4a98
fix test case
scwf 6db4bf5
also fix for HiveContext
scwf 2a56515
fix conflicts
scwf a3f7659
remove unsed imports
scwf b35529e
minor style
scwf 9e11752
improve SimpleCatalystConf
scwf b73df6c
style issue
scwf 269cf21
fix conflicts
scwf 4ef1be7
fix conflicts
scwf af512c7
fix conflicts
scwf d4b724f
address michael's comment
scwf cd51712
fix compile
scwf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/CatalystConf.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.spark.sql.catalyst | ||
|
|
||
| private[spark] trait CatalystConf { | ||
| def caseSensitiveAnalysis: Boolean | ||
| } | ||
|
|
||
| /** | ||
| * A trivial conf that is empty. Used for testing when all | ||
| * relations are already filled in and the analyser needs only to resolve attribute references. | ||
| */ | ||
| object EmptyConf extends CatalystConf { | ||
| override def caseSensitiveAnalysis: Boolean = { | ||
| throw new UnsupportedOperationException | ||
| } | ||
| } | ||
|
|
||
| /** A CatalystConf that can be used for local testing. */ | ||
| case class SimpleCatalystConf(caseSensitiveAnalysis: Boolean) extends CatalystConf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,10 +17,12 @@ | |
|
|
||
| package org.apache.spark.sql | ||
|
|
||
| import java.util.Properties | ||
|
|
||
| import scala.collection.immutable | ||
| import scala.collection.JavaConversions._ | ||
|
|
||
| import java.util.Properties | ||
| import org.apache.spark.sql.catalyst.CatalystConf | ||
|
|
||
| private[spark] object SQLConf { | ||
| val COMPRESS_CACHED = "spark.sql.inMemoryColumnarStorage.compressed" | ||
|
|
@@ -32,6 +34,7 @@ private[spark] object SQLConf { | |
| val CODEGEN_ENABLED = "spark.sql.codegen" | ||
| val UNSAFE_ENABLED = "spark.sql.unsafe.enabled" | ||
| val DIALECT = "spark.sql.dialect" | ||
| val CASE_SENSITIVE = "spark.sql.caseSensitive" | ||
|
Contributor
Author
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. now place this config in SQLConf |
||
|
|
||
| val PARQUET_BINARY_AS_STRING = "spark.sql.parquet.binaryAsString" | ||
| val PARQUET_INT96_AS_TIMESTAMP = "spark.sql.parquet.int96AsTimestamp" | ||
|
|
@@ -89,7 +92,8 @@ private[spark] object SQLConf { | |
| * | ||
| * SQLConf is thread-safe (internally synchronized, so safe to be used in multiple threads). | ||
| */ | ||
| private[sql] class SQLConf extends Serializable { | ||
|
|
||
| private[sql] class SQLConf extends Serializable with CatalystConf { | ||
| import SQLConf._ | ||
|
|
||
| /** Only low degree of contention is expected for conf, thus NOT using ConcurrentHashMap. */ | ||
|
|
@@ -158,6 +162,11 @@ private[sql] class SQLConf extends Serializable { | |
| */ | ||
| private[spark] def codegenEnabled: Boolean = getConf(CODEGEN_ENABLED, "false").toBoolean | ||
|
|
||
| /** | ||
| * caseSensitive analysis true by default | ||
| */ | ||
| def caseSensitiveAnalysis: Boolean = getConf(SQLConf.CASE_SENSITIVE, "true").toBoolean | ||
|
|
||
| /** | ||
| * When set to true, Spark SQL will use managed memory for certain operations. This option only | ||
| * takes effect if codegen is enabled. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need to change this into a function because it'll never change.
I'm more of a fan of this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It actually can change since you can set SQL config at runtime, in between queries. Also scala does not have a ternary operator.