-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-12409][SQL]add filter (IN, AND, OR) #10386
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -269,6 +269,13 @@ private[sql] class JDBCRDD( | |
| case stringValue: String => s"'${escapeSql(stringValue)}'" | ||
| case timestampValue: Timestamp => "'" + timestampValue + "'" | ||
| case dateValue: Date => "'" + dateValue + "'" | ||
| case objectValue: Array[Object] => { | ||
| val str = objectValue.map { | ||
| case string: String => s"'${escapeSql(string)}'" | ||
| case other => s"${escapeSql(other.toString)}" | ||
| } | ||
| str.mkString(",") | ||
| } | ||
| case _ => value | ||
| } | ||
|
|
||
|
|
@@ -288,6 +295,12 @@ private[sql] class JDBCRDD( | |
| case GreaterThanOrEqual(attr, value) => s"$attr >= ${compileValue(value)}" | ||
| case IsNull(attr) => s"$attr IS NULL" | ||
| case IsNotNull(attr) => s"$attr IS NOT NULL" | ||
| case In(attr, value) => s"$attr IN (${compileValue(value)})" | ||
| case Not(In(attr, value)) => s"$attr NOT IN (${compileValue(value)})" | ||
|
Member
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. ISTM we do not need this entry by calling |
||
| case Or(filter1, filter2) => | ||
| "(" + compileFilter (filter1) + ") OR (" + compileFilter (filter2) + ")" | ||
|
Member
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.
|
||
| case And(filter1, filter2) => | ||
| "(" + compileFilter (filter1) + ") AND (" + compileFilter (filter2) + ")" | ||
|
Member
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. The same fixes needed above. |
||
| case _ => null | ||
| } | ||
|
|
||
|
|
||
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.
Nit: Remove unnecessary space by referring other codes