-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-39914][SQL] Add DS V2 Filter to V1 Filter conversion #37332
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
Conversation
|
The GA failure doesn't seem relevant. |
|
@cloud-fan Could you please take a look when you have time? Thanks! |
| Some(In(attribute, Array.empty[Any])) | ||
| } | ||
|
|
||
| case "=" | "<=>" | ">" | "<" | ">=" | "<=" if predicate.children().length == 2 && |
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.
Both case "=" | "<=>" | ">" | "<" | ">=" | "<=" and "STARTS_WITH" | "ENDS_WITH" | "CONTAINS" use condition
if predicate.children().length == 2 &&
predicate.children()(0).isInstanceOf[NamedReference] &&
predicate.children()(1).isInstanceOf[LiteralValue[_]]
Is it necessary to extract a function?
This reverts commit a167e61.
|
|
||
| case "AND" => | ||
| val and = predicate.asInstanceOf[V2And] | ||
| Some(And(toV1(and.left()).get, toV1(and.right()).get)) |
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 return None if any of the children can't be converted to v1.
| case "=" | "<=>" | ">" | "<" | ">=" | "<=" if isValidBinaryPredicate => | ||
| val attribute = predicate.children()(0).toString | ||
| val value = predicate.children()(1).asInstanceOf[LiteralValue[_]] | ||
| predicate.name() match { |
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:
val v1Value = CatalystTypeConverters.convertToScala(value.value, value.dataType)
val v1Filter = predicate.name() match {
case "=" =>EqualTo(attribute, v1Value)
...
}
Some(v1Filter)
|
|
||
| case "NOT" => | ||
| val not = predicate.asInstanceOf[V2Not] | ||
| Some(Not(toV1(not.child()).get)) |
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.
toV1(not.child()) may not always return Some
|
Thanks for reviewing! Merged to master. |
What changes were proposed in this pull request?
Add util methods to convert DS V2 Filter to V1 Filter.
Why are the changes needed?
Provide convenient methods to convert V2 to V1 Filters. These methods can be used by
SupportsRuntimeFilteringand later be used bySupportsDeleteDoes this PR introduce any user-facing change?
No. These are intended for internal use only
How was this patch tested?
new tests