-
Notifications
You must be signed in to change notification settings - Fork 73
columns selector type #1274
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
base: master
Are you sure you want to change the base?
columns selector type #1274
Conversation
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.
some small notes, but otherwise great :)
|
||
### Column Resolvers | ||
|
||
`ColumnResolver` is the base type used to access columns within the **Columns Selection DSL**, |
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.
*ColumnsResolver
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 not "access" because it can also point to columns that are created on-the-fly like with arithmetics or expr-columns. I think "resolve" is the best way to phrase it.
### Column Resolvers | ||
|
||
`ColumnResolver` is the base type used to access columns within the **Columns Selection DSL**, | ||
as well as the return type of columns selection expressions. |
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 write it like "column(s)", because it's the return type of both the singular and multiple columns dsl
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 use it as generalized name of Dsl
- **`SingleColumn`** — resolves to a single [`DataColumn`](DataColumn.md). | ||
- **`ColumnAccessor`** — a specialized `SingleColumn` with a defined path and type argument. | ||
It can also be renamed during selection. | ||
- **`ColumnPath`** — a wrapper for [`DataColumn`](DataColumn.md) path |
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.
*a wrapper for a DataColumn path
- **`ColumnAccessor`** — a specialized `SingleColumn` with a defined path and type argument. | ||
It can also be renamed during selection. | ||
- **`ColumnPath`** — a wrapper for [`DataColumn`](DataColumn.md) path | ||
in [`DataFrame`](DataFrame.md) also can serve as a `ColumnAccessor`. |
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.
in a DataFrame
in [`DataFrame`](DataFrame.md) also can serve as a `ColumnAccessor`. | ||
```kotlin | ||
// Select all columns from the group by path "group2"/"info": | ||
df.select { pathOf("group2", "info").cols() } |
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.
.allCols()
is better isn't it?
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.
But what's difference?
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.
allCols()
has compiler plugin support :) cols {}
is a filter. (we should probably remove the default { true }
predicate in cols, come to think of it.
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.
okay not yet for column paths, but it's generally good advice when you don't want to filter
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.
df.group { colsAtAnyDepth().colsOf<String>() } | ||
.into { it.path.dropLast(2) } | ||
``` | ||
- **`ColumnSet`** — resolves to a list of [`DataColumn`s](DataColumn.md). |
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 sure if we should mention again that this is not really a set, or if it's clear enough when we say it's a list like this.
Try to close #1240