-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-25469][SQL] Eval methods of Concat, Reverse and ElementAt should use pattern matching only once #22471
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
|
@ueshin can you review? |
|
Test build #96277 has finished for PR 22471 at commit
|
| override def eval(input: InternalRow): Any = dataType match { | ||
| override def eval(input: InternalRow): Any = evalFunction(input) | ||
|
|
||
| @transient private lazy val evalFunction: InternalRow => Any = dataType 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.
We don't @transient here? For example, the similar logic has no transient:
spark/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala
Line 1252 in 47d6e80
| private lazy val mapCatalystConverter: Any => (Array[Any], Array[Any]) = { |
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.
Also, how about evalFunction -> concatFunction or doConcat?
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 ti's good to have a transient to reduce closure size
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.
aha, I ses.
| case BinaryType => | ||
| val inputs = children.map(_.eval(input).asInstanceOf[Array[Byte]]) | ||
| ByteArray.concat(inputs: _*) | ||
| (input) => { |
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 don't need brackets: (input) -> input
|
@mn-mikke As you pointed out, I think we need to fix |
|
LGTM except for the minor comments |
ueshin
left a comment
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, I agree that we should fix Reverse. Seems like we can do this for ElementAt as well?
|
If you don't mind, I will include fixes for |
|
@mn-mikke Sure. I'm okay with including them to this pr. Thanks! |
|
LGTM, pending Jenkins. |
|
@maropu Could you take a look at this again please? |
|
Test build #96340 has finished for PR 22471 at commit
|
|
ok |
|
LGTM Btw, we don't need |
|
@maropu Do you want to merge this as your first work as a committer? |
|
away from keyboard now, so will do when I’m back. Thanks! |
…ld use pattern matching only once ## What changes were proposed in this pull request? The PR proposes to avoid usage of pattern matching for each call of ```eval``` method within: - ```Concat``` - ```Reverse``` - ```ElementAt``` ## How was this patch tested? Run the existing tests for ```Concat```, ```Reverse``` and ```ElementAt``` expression classes. Closes #22471 from mn-mikke/SPARK-25470. Authored-by: Marek Novotny <[email protected]> Signed-off-by: Takeshi Yamamuro <[email protected]> (cherry picked from commit 2c9d8f5) Signed-off-by: Takeshi Yamamuro <[email protected]>
|
Thanks! merging to master/2.4. |
What changes were proposed in this pull request?
The PR proposes to avoid usage of pattern matching for each call of
evalmethod within:ConcatReverseElementAtHow was this patch tested?
Run the existing tests for
Concat,ReverseandElementAtexpression classes.