优化 DataFrameOperator#153
Open
shengtianyang wants to merge 3 commits into
Open
Conversation
HC-teemo
reviewed
Jan 6, 2025
HC-teemo
left a comment
Collaborator
There was a problem hiding this comment.
There seems to be an issue with the code structure. Why is the code you added before the old code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
STY个人完成
小组名称STY
对DefaultDateFrameOperator.scala主要改进点及注释总结:
缓存表达式计算结果:
添加了 evalCache 和 cachedEval 方法来缓存表达式的计算结果,避免重复计算。
提取公共逻辑:
提取了 createContext 方法,用于创建上下文,减少了重复代码。
减少中间数据结构的创建:
在 distinct 和 orderBy 方法中使用了 Iterator 来减少中间集合的创建。
简化复杂逻辑:
使用 collectFirst 简化了 _ascCmp 方法中的比较逻辑,替代了显式的 while 循环。
增加异常处理和参数校验:
在 join 方法中增加了异常处理和参数校验,确保输入参数的有效性。