-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-24505][SQL] Forbidding string interpolation in CodeBlock #21520
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
|
Test build #91619 has finished for PR 21520 at commit
|
|
Test build #91621 has finished for PR 21520 at commit
|
|
retest this please. |
|
Test build #91624 has finished for PR 21520 at commit
|
|
Sorry this change is quite large, but it can't split into smaller pieces because it must be changed as a whole to pass compilation. |
|
Test build #91631 has finished for PR 21520 at commit
|
|
Thank you for a lot of works to update many places. It is very hard to split it into several pieces. Now, we are seeing several typical patterns in the all of changes, in paticular by wrapping the original code. Would it be possible to make changes simpler by introducing several APIs?
Can we introduce new APIs to avoid repetations of adding
For example, we may introduce these APIs. The first one calls WDYT? |
|
yes, this is a great work @viirya ! It would be great if we can split it into smaller updates. What do you think about starting doing the needed changes in smaller PRs which focus only on specific part and forbidding the string interpolation after those have made the needed changes smaller? I also like and agree with @kiszk about introducing new APIs. In particular, in the last days I checked the part related to the usage of Another change I was thinking about order to avoid code duplication, IMHO, is to add a common class to Global and Local variable with a What do you think? |
|
@kiszk @mgaido91 Thanks for your comment!
By disallowing string interpolation in code blocks, any strings passed into a code block won't pass the compilation. It is also more guaranteed that we don't miss any strings. It is why this change is quite big and not in many smaller pieces. Most important is, I need to have all the changes together to see if we can pass all the tests once we completely forbid string interpolation. But it doesn't mean we need to review and merge this big change. It is still possible to break this into smaller PRs. It may work like this:
WDYT? |
@kiszk I initially took a similar approach but found soon that I'd create too many APIs. I'm not pretty sure if that is what we want to have distinguish them in API level because they are all actually a simple piece of inline string in code, so I turned to a
Yes, I noticed that too. I was planning to change existing API such as |
|
For 1, I agree with you that it is not good to introduce many APIs at first. On the other hand, it would be good to prepare only a few APIs that are frequently used, not to prepare many APIs. It make code simpler and cleaner. For 2, new APIs in WDYT? |
|
@kiszk Seems good to me. I will go to create and use those APIs in pieces of PRs. |
|
As I will incrementally split this into smaller PRs, I will first close this. |
|
@viirya ~ I was just trying to read the PRs. Would you please mind if I ask where is the "Based on previous discussion" ? |
|
@HyukjinKwon Thanks for looking into this. It is based on the comment and discussion here #21193 (comment). |
…ndAttribute ## What changes were proposed in this pull request? This is split from #21520. This includes changes of `BoundAttribute` and `Cast`. This patch also adds few convenient APIs: ```scala CodeGenerator.freshVariable(name: String, dt: DataType): VariableValue CodeGenerator.freshVariable(name: String, javaClass: Class[_]): VariableValue JavaCode.javaType(javaClass: Class[_]): Inline JavaCode.javaType(dataType: DataType): Inline JavaCode.boxedType(dataType: DataType): Inline ``` ## How was this patch tested? Existing tests. Closes #21537 from viirya/SPARK-24505-1. Authored-by: Liang-Chi Hsieh <[email protected]> Signed-off-by: hyukjinkwon <[email protected]>
What changes were proposed in this pull request?
The code block interpolator currently accepts strings. Based on previous discussion, we should forbid string interpolation to prevent losing references to expressions (
ExprValue) in code blocks.How was this patch tested?
Existing tests.