-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[SPARK-52551][SQL] Add a new v2 Predicate BOOLEAN_EXPRESSION #51247
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
base: master
Are you sure you want to change the base?
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 |
---|---|---|
|
@@ -37,12 +37,21 @@ class V2ExpressionBuilder(e: Expression, isPredicate: Boolean = false) extends L | |
def build(): Option[V2Expression] = generateExpression(e, isPredicate) | ||
|
||
def buildPredicate(): Option[V2Predicate] = { | ||
|
||
if (isPredicate) { | ||
val translated = build() | ||
val translated0 = build() | ||
val conf = SQLConf.get | ||
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. Hold the 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. This is within a single method, I don't think we want to be that dynamic. And in practise this should be run within the same session so it won't change. |
||
val alwaysCreateV2Predicate = conf.getConf(SQLConf.DATA_SOURCE_ALWAYS_CREATE_V2_PREDICATE) | ||
val translated = if (alwaysCreateV2Predicate && e.dataType == BooleanType) { | ||
translated0.map { | ||
case p: V2Predicate => p | ||
case other => new V2Predicate("BOOLEAN_EXPRESSION", Array(other)) | ||
} | ||
} else { | ||
translated0 | ||
} | ||
|
||
val modifiedExprOpt = if ( | ||
SQLConf.get.getConf(SQLConf.DATA_SOURCE_DONT_ASSERT_ON_PREDICATE) | ||
conf.getConf(SQLConf.DATA_SOURCE_DONT_ASSERT_ON_PREDICATE) | ||
&& translated.isDefined | ||
&& !translated.get.isInstanceOf[V2Predicate]) { | ||
|
||
|
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.
I think we should use
final
to modify "BOOLEAN_EXPRESSION".