-
Notifications
You must be signed in to change notification settings - Fork 29.2k
[Spark-20145] Fix range case insensitive bug in SQL #17487
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 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3d2a3ba
add failing test
samelamin ee15dc0
SPARK-20145: lower case value passed into map to make the statement c…
samelamin 407bdbf
use sql conf to get case sensitivity
samelamin ccbfcb3
pass failing test
samelamin e1541b4
pass failing test (reverted from commit ccbfcb32c1e5ccf83c3aea473e309…
samelamin de7b8a6
use sql conf to get case sensitivity (reverted from commit 407bdbf1ae…
samelamin 8bce1da
revert based on comments from pr
samelamin ad5780a
code cleanup
samelamin 6efb254
remove empty spaces
samelamin a01aba6
remove vars and use actual SQL
selamin 406eba8
remove unused test
selamin 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
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 |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ import org.apache.spark.sql.catalyst.expressions.codegen.{CodegenContext, Codege | |
| import org.apache.spark.sql.catalyst.plans.logical.{LeafNode, LogicalPlan} | ||
| import org.apache.spark.sql.catalyst.trees.TreeNode | ||
| import org.apache.spark.sql.catalyst.util.quoteIdentifier | ||
| import org.apache.spark.sql.internal.SQLConf | ||
| import org.apache.spark.sql.types.{DataType, Metadata, StructType} | ||
|
|
||
| /** | ||
|
|
@@ -69,9 +70,15 @@ case class UnresolvedInlineTable( | |
| * select * from range(10); | ||
| * }}} | ||
| */ | ||
| case class UnresolvedTableValuedFunction(functionName: String, functionArgs: Seq[Expression]) | ||
| case class UnresolvedTableValuedFunction(conf: SQLConf, | ||
|
Contributor
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. @samelamin this is a moot point now, but try to avoid mutable state as much as you can. In this case it would have been better to pass the SQLConf class as a parameter to the |
||
| var functionName: String, | ||
| functionArgs: Seq[Expression]) | ||
| extends LeafNode { | ||
|
|
||
| if (!conf.caseSensitiveAnalysis) { | ||
| functionName = functionName.toLowerCase | ||
| } | ||
|
|
||
| override def output: Seq[Attribute] = Nil | ||
|
|
||
| override lazy val resolved = false | ||
|
|
||
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
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.
Does the function name is case sensitive in Hive?
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.
What do you mean? There are no table valued functions in Hive.
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.
@samelamin you have to make this dependent on the case sensitivity setting of the analyzer. This means you will have to turn this object into case class that takes a SQLConf as its argument.
Uh oh!
There was an error while loading. Please reload this page.
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.
ok cool thanks @hvanhovell ill amend it over the weekend. Do you know how I can run a specific set of tests on SBT?
im getting garbage collection errors when I try to run using sbt test-only form http://spark.apache.org/developer-tools.html
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.
For example,
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.
@hvanhovell instead of creating a new case class, is there a way I can reuse the UnresolvedTableValuedFunction case class and just add in the SQLConf class?
Uh oh!
There was an error while loading. Please reload this page.
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.
Yeah, @gatorsmile is right. We don't do case sensitive resolution for functions. So you can ignore my comment, and undo the last change you have made.
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.
So would you like me to revert the change to the case class?
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.
Yes, sorry about that!
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.
Ok I can revert but how will we test it since the apply method isn't being called by the tests. They new up an unresolvedTableValuedFunction? Unless we hardcore it in unresolvedTableValuedFunction to always be case insensitive then I don't know how else to do it?