-
Notifications
You must be signed in to change notification settings - Fork 69
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
Rename to camelCase support in compiler plugin #1029
Conversation
class RenameToCamelCaseClause : AbstractSchemaModificationInterpreter() { | ||
val Arguments.receiver: RenameClauseApproximation by arg() | ||
|
||
override fun Arguments.interpret(): PluginDataFrameSchema { |
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'd suggest convert selected columns to path and receiver.df.asDataFrame().rename { paths }.toCamelCase().toPluginDataFrameSchema()
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.
that's easier indeed
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.
and it promotes the idea that the original function solves the compiler plugin part :) which is great. I just need to become a bit more comfortable with the helper functions available to me in the compiler plugin module, but I'll get there :)
) | ||
val renamed = df.renameToCamelCase() | ||
|
||
// Verify extension properties |
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.
this is redundant here, no point testing runtime behaviour
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.
not entirely, it's still worth checking that the generated property actually has the value we expect it to have. Could catch a potential bugs like types not being recognized or accessors mismatching the correct columns
return SimpleFrameColumn( | ||
name, | ||
f(columns(), nextName, selected, path) | ||
internal fun SimpleFrameColumn.map( |
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.
Please, for easy and fast reviews let's hold changes related to linting and other non-functional changes
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 put it in a separate commit, so you can skip those if you wish
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.
as mentioned in the comments
88599a7
to
cd5888c
Compare
Fixes #1025
Adds compiler plugin support for
DataFrame.renameToCamelCase()
andDataFrame.rename {}.toCamelCase()
Got some help from Junie :) The first function was almost entirely written by AI, the second one needed a more guiding hand from me.
See commit messages for more specifics