-
Notifications
You must be signed in to change notification settings - Fork 70
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
Move toLeft -> toStart, toRight -> toEnd, add move KDocs #1071
base: master
Are you sure you want to change the base?
Conversation
Uhm, we should probably keep the old functions, deprecate them (with ERROR right away is fine), and direct our users to the new ones. |
Brought them back with Error-level deprecation |
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.
Great job! This was not an easy function to document. Just a couple comments here and there
* {@include [LineBreak]} | ||
* {@include [DslGrammarLink]} | ||
* {@include [LineBreak]} | ||
* |
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.
Very nice! However, you're missing the definitions of the types you use. (fuck, I see I forgot it in update
as well) Each grammar dsl in the selection dsl does have definitions on top. something like:
`colsSelector: `[ColumnsSelector]
`pathSelector: `[...]
This makes the grammar complete if we want to reuse it on writerside with @ExportAsHtml (Since there you cannot click on types anymore).
In the selection dsl, for each reference, I made a -Def and a -Ref variant (https://github.com/Kotlin/dataframe/blob/master/KDOC_PREPROCESSING.md#advanced-dsl-grammar-templating-columns-selection-dsl), something like:
/** `colsSelector: `[`ColumnsSelector`][ColumnsSelector] */
public interface ColumnsSelectorDef
(included at the definitions part of the grammar dsl)
/** [`colsSelector`][ColumnsSelectorDef] */
public interface ColumnsSelectorRef
(included at the actual notation part of the grammar dsl)
That way users can click on the reference, see the definition, and in the definition click on the type to see the actual type. This way you can also have a reference to a definition with multiple types allowed.
/** | ||
* ## The Move Operation | ||
* | ||
* Moves the specified [columns] within the [DataFrame]. |
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.
KoDEx incorrectly recognizes [columns]
as org.jetbrains.kotlinx.dataframe.columns
, making it link up wrong. You can break the reference here by writing [columns\]
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 check this in other places as well
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.
done
* which serves as an intermediate step. The [MoveClause] allows specifying the final | ||
* destination of the selected columns using methods such as [MoveClause.to], [MoveClause.toStart], | ||
* [MoveClause.toEnd], [MoveClause.into], [MoveClause.intoIndexed], [MoveClause.toTop], | ||
* [MoveClause.after] or [MoveClause.under], that return a new [DataFrame] with updated columns order. |
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.
probably alias these links like [to][MoveClause.to]
, that reads a bit easier :)
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.
It's not just an updated order, right? It's an updated structure, I'd say
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.
done
* @include [CommonMoveDocs] | ||
* @include [SelectingColumns.Dsl] {@include [SetMoveOperationArg]} | ||
* ### Examples: | ||
* ``` |
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 write these examples starting with "```kt
" so they are colored like Kotlin code
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.
done
* df.move("columnA", "columnB").after("columnC") | ||
* df.move("age").under("info") | ||
* ``` | ||
* @param [columns] The [Column Names][String] used to select the columns of this [DataFrame] to move. |
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.
If you want to link to something for column links, could I suggest org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.ColumnNames?
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 just followed a template from select
KDocs.
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.
* @param [columns] The [Column Names][String] used to select the columns of this [DataFrame].
*/
public fun <T> DataFrame<T>.select(vararg columns: String): DataFrame<T> = select { columns.toColumnSet() }
/** | ||
* ## The MoveToStart Operation | ||
* | ||
* Moves the specified [columns] to the [DataFrame] start. |
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.
maybe specify that this means the top-level, or do you think that's clear enough from this?
* | ||
* For more information: {@include [DocumentationUrls.Move]} | ||
*/ | ||
internal interface MoveToEnd { |
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 probably couldn't help myself and create a generic MoveToX doc hahaha, but that would probably be overkill, great job :)
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.
done
/** | ||
* ## Move Into | ||
* | ||
* Moves columns, previously selected with [move] into a new position specified with a |
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.
*specified by
public fun <T, C> MoveClause<T, C>.to(columnIndex: Int): DataFrame<T> = moveTo(columnIndex) | ||
|
||
/** | ||
* ## Move ToTop |
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.
Seems you are a bit inconsistent with the names of the sub-operations. Some are written like "Move ToTop", others like "MoveToStart". I assume you did this to mirror the function names, however it may be more readable to just separate them all by spaces and use Titlecase, like "Move to Top", "Move to Start", etc. Also, you'll make nikita happy if you use a couple more #
's so the titles become a bit smaller
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.
OK, so let's make a convention for all of this.
My logic was like this:
If its a complete operation (that is DF-> DF : moveToStart
, moveToEnd
) then it will have the full name in Upper Camel Case.
If it's a part of move operation (MoveClase -> DF), I write "Move" + this operation in UCC.
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 would favor readability over it following the function name exactly here. Users can already see the function name when they click to read the KDoc, so the title can just be a simple readable title I think.
* | ||
* ### This After Overload | ||
*/ | ||
internal interface MoveAfter |
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 can be @ExcludeFromSources
, right?
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.
Probable :) Done.
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.
No objection from my side after fixing comments from @Jolanrensen
Great job, I've learned also something new about the KoDex
toLeft
->toStart
,toRight
->toEnd
#1027move
#813