Skip to content

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

columns selector type #1274

wants to merge 2 commits into from

Conversation

AndreiKingsley
Copy link
Collaborator

Try to close #1240

@Jolanrensen Jolanrensen self-requested a review June 25, 2025 14:11
@Jolanrensen Jolanrensen added the documentation Improvements or additions to documentation (not KDocs) label Jun 26, 2025
Copy link
Collaborator

@Jolanrensen Jolanrensen left a 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**,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*ColumnsResolver

Copy link
Collaborator

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.
Copy link
Collaborator

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

Copy link
Collaborator Author

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
Copy link
Collaborator

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`.
Copy link
Collaborator

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() }
Copy link
Collaborator

@Jolanrensen Jolanrensen Jun 26, 2025

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But what's difference?

Copy link
Collaborator

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.

Copy link
Collaborator

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

Copy link
Collaborator

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).
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation (not KDocs)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rephrase mentions of ColumnAccessor on column selectors page
2 participants