Skip to content
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

[SPARK-25223][SQL] Use a map to store values for NamedLambdaVariable. #22216

Closed
wants to merge 2 commits into from

Conversation

ueshin
Copy link
Member

@ueshin ueshin commented Aug 24, 2018

What changes were proposed in this pull request?

Currently we use functionsForEval, NamedLambdaVaribles in which are replace with of arguments from the original functions, to make sure the lambda variables refer the same instances as of arguments, but it's pretty hacky.
Instead, we can use a global map and set/get the lambda variable values in the map.

How was this patch tested?

Existing tests.

@ueshin
Copy link
Member Author

ueshin commented Aug 24, 2018

cc @cloud-fan

@SparkQA
Copy link

SparkQA commented Aug 24, 2018

Test build #95203 has finished for PR 22216 at commit c27121b.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

object NamedLambdaVariable {

private[this] val _values =
new ThreadLocal[mutable.Map[NamedLambdaVariable, Any]] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we use ExprId as the key?

@hvanhovell
Copy link
Contributor

I think the use of global state and a thread local is far more hacky and probably is slower.

The only clean solution I see here is to pass the lambda values around using the input row. I am not saying that this easy.

@ueshin
Copy link
Member Author

ueshin commented Aug 25, 2018

I see. Let me think again. I'd close this for now. Thanks!

@ueshin ueshin closed this Aug 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants