Skip to content

Commit f40a021

Browse files
committed
Merge branch 'master' into jpc-kdoc-reuse
# Conflicts: # core/build.gradle.kts # core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/Nulls.kt # core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/groupBy.kt # core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/select.kt # core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/update.kt
2 parents 61e01c8 + e68fd73 commit f40a021

File tree

149 files changed

+1533
-697
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+1533
-697
lines changed

.github/workflows/main.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Build docs
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
id-token: write
8+
pages: write
9+
10+
env:
11+
PRODUCT: StardustDocs/d
12+
ARTIFACT: webHelpD2-all.zip
13+
ALGOLIA_ARTIFACT: algolia-indexes-D.zip
14+
ALGOLIA_APP_NAME: OHIV241QET
15+
ALGOLIA_INDEX_NAME: prod_JETBRAINSCOM_HELP
16+
ALGOLIA_KEY: ${{ secrets.ALGOLIA_KEY }}
17+
CONFIG_JSON_PRODUCT: Dataframe
18+
CONFIG_JSON_VERSION: 0.9
19+
20+
jobs:
21+
build-job:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v3
26+
- name: Build Writerside docs using Docker
27+
uses: JetBrains/writerside-github-action@v3
28+
- name: Upload artifact
29+
uses: actions/upload-artifact@v3
30+
with:
31+
name: artifact
32+
path: artifacts/${{ env.ARTIFACT }}
33+
retention-days: 7
34+
- name: Upload algolia-indexes
35+
uses: actions/upload-artifact@v3
36+
with:
37+
name: algolia-indexes
38+
path: artifacts/${{ env.ALGOLIA_ARTIFACT }}
39+
retention-days: 7
40+
41+
deploy:
42+
environment:
43+
name: github-pages
44+
url: ${{ steps.deployment.outputs.page_url }}
45+
needs: build-job
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Download artifact
49+
uses: actions/download-artifact@v3
50+
with:
51+
name: artifact
52+
- name: Unzip artifact
53+
uses: montudor/action-zip@v1
54+
with:
55+
args: unzip -qq ${{ env.ARTIFACT }} -d dir
56+
- name: Setup Pages
57+
uses: actions/configure-pages@v2
58+
- name: Upload artifact
59+
uses: actions/upload-pages-artifact@v1
60+
with:
61+
path: dir
62+
- name: Deploy to GitHub Pages
63+
id: deployment
64+
uses: actions/deploy-pages@v1
65+
66+
publish-indexes:
67+
# Requires the build-job results
68+
needs: build-job
69+
runs-on: ubuntu-latest
70+
container:
71+
image: registry.jetbrains.team/p/writerside/builder/algolia-publisher:2.0.32-2
72+
73+
steps:
74+
- uses: actions/checkout@v3
75+
- uses: actions/download-artifact@v3
76+
with:
77+
name: algolia-indexes
78+
- uses: montudor/action-zip@v1
79+
with:
80+
args: unzip -qq algolia-indexes-D.zip -d algolia-indexes
81+
- run: |
82+
env "algolia-key=${{env.ALGOLIA_KEY}}" java -jar /opt/builder/help-publication-agent.jar \
83+
update-index \
84+
--application-name ${{env.ALGOLIA_APP_NAME}} \
85+
--index-name ${{env.ALGOLIA_INDEX_NAME}} \
86+
--product ${{env.CONFIG_JSON_PRODUCT}} \
87+
--version ${{env.CONFIG_JSON_VERSION}} \
88+
--index-directory algolia-indexes/ \
89+
2>&1 | tee algolia-update-index-log.txt

.space.kts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import java.nio.file.Files
2+
import java.nio.file.Paths
3+
4+
job("Polaris Artifact") {
5+
container("registry.jetbrains.team/p/sa/public/qodana-jvm:polaris") {
6+
kotlinScript { api ->
7+
val spaceProjectKey = System.getenv("JB_SPACE_PROJECT_KEY")
8+
val repoName = System.getenv("JB_SPACE_GIT_REPOSITORY_NAME")
9+
val initialPath = System.getenv("JB_SPACE_FILE_SHARE_PATH")
10+
val tid: String = api.space().projects.getProject(ProjectIdentifier.Key(spaceProjectKey)) {
11+
repos {
12+
id()
13+
name()
14+
}
15+
}.repos.first { it.name == repoName }.id!!
16+
Files.write(Paths.get("$initialPath/tid"), tid.encodeToByteArray())
17+
}
18+
}
19+
container("registry.jetbrains.team/p/sa/public/qodana-jvm:polaris")
20+
}

CONTRIBUTING.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Contributing Guidelines
2+
3+
There are two main ways to contribute to the project — submitting issues and submitting
4+
fixes/changes/improvements via pull requests.
5+
6+
## Submitting issues
7+
8+
Both bug reports and feature requests are welcome.
9+
Submit issues [here](https://github.com/Kotlin/dataframe/issues).
10+
11+
* Search for existing issues to avoid reporting duplicates.
12+
* When submitting a bug report:
13+
* Test it against the most recently released version. It might have already been fixed.
14+
* Include the code reproducing the problem or attach the link to the repository with the project that fully reproduces the problem.
15+
* However, don't put off reporting any weird or rarely appearing issues just because you cannot consistently
16+
reproduce them.
17+
* If the bug is in behavior, then explain what behavior you've expected and what you've got.
18+
* When submitting a feature request:
19+
* Explain why you need the feature &mdash, your use case, and your domain.
20+
* Explaining the problem you face is more important than suggesting a solution.
21+
Report your issue even if you don't have any proposed solution.
22+
* If there is an alternative way to do what you need, show the alternative's code.
23+
24+
25+
## Submitting PRs
26+
27+
We love PRs. Submit PRs [here](https://github.com/Kotlin/dataframe/pulls).
28+
However, please keep in mind that maintainers will have to support the resulting code of the project,
29+
so do familiarize yourself with the following guidelines.
30+
31+
* All development (both new features and bug fixes) is performed in the `master` branch.
32+
* Base PRs against the `master` branch.
33+
* PR should be linked with the issue,
34+
excluding minor documentation changes, adding unit tests, and fixing typos.
35+
* If you make any code changes:
36+
* Follow the [Kotlin Coding Conventions](https://kotlinlang.org/docs/reference/coding-conventions.html).
37+
* [Build the project](#building) to ensure it all works and passes the tests.
38+
* If you fix a bug:
39+
* Write the test that reproduces the bug.
40+
* Fixes without tests are accepted only in exceptional circumstances if it can be shown that writing the
41+
corresponding test is too hard or otherwise impractical.
42+
* If you introduce any new public APIs:
43+
* All new APIs must come with documentation and tests.
44+
* If you plan API additions, please start by submitting an issue with the proposed API design
45+
to gather community feedback.
46+
* [Contact the maintainers](#contacting-maintainers) to coordinate any great work in advance via submitting an issue.
47+
* If you fix documentation:
48+
* If you plan extensive rewrites/additions to the docs, then please [contact the maintainers](#contacting-maintainers)
49+
to coordinate the work in advance.
50+
* Also, we have a special simple [guide](https://github.com/Kotlin/dataframe/blob/master/docs/contributions.md) how to contribute in the documentation.
51+
52+
## PR workflow
53+
54+
0. The contributor builds the library locally and runs all unit tests via the Gradle task `dataframe:test`
55+
(see the ["Building"](#building) chapter).
56+
1. The contributor submits the PR if the local build is successful and the tests are green.
57+
2. The reviewer put his name in the "Reviewers" section of the proposed PR at the start of the review process.
58+
3. The reviewer leaves the comments or marks the PR with the abbreviation "LGTM" (Looks good to me).
59+
4. The contributor answers the comments or fixes the proposed PR.
60+
5. The reviewer marks the PR with the word "LGTM."
61+
6. The maintainer could suggest merging the master branch to the PR branch a few times due to changes in the `master` branch.
62+
7. The maintainer runs TC builds (unit tests and examples as integration tests).
63+
8. TC writes the result (passed or not passed) to the PR checks at the bottom of the proposed PR.
64+
9. If it is possible, maintainers share the details of the failed build with the contributor.
65+
10. Maintainer merges the PR if all checks are successful and there is no conflict with the master branch.
66+
67+
## How to fix an existing issue
68+
69+
* If you are going to work on the existing issue:
70+
* Comment on the existing issue if you want to work on it.
71+
* Wait till it is assigned to you by [maintainers](#contacting-maintainers).
72+
* Ensure that the issue describes a problem and a solution that has received positive feedback. Propose a solution if there isn't any.
73+
* If you are going to submit your first PR in this project:
74+
* Find tickets with the label ["good first issue"](https://github.com/Kotlin/dataframe/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22+no%3Aassignee)
75+
which are not assigned to somebody.
76+
* Learn the [`examples`](https://github.com/Kotlin/dataframe/tree/master/examples) module. Submit an interesting new example or improve documentation for one of them.
77+
* If you are ready to participate in library design and new experiments, find tickets with the label
78+
["research"](https://github.com/Kotlin/dataframe/issues?q=is%3Aissue+is%3Aopen+label%3Aresearch)
79+
or join our [discussions](https://github.com/Kotlin/dataframe/discussions).
80+
81+
82+
## Environment requirements
83+
84+
JDK >= 11 referred to by the `JAVA_HOME` environment variable.
85+
86+
## Building
87+
88+
This library is built with Gradle.
89+
90+
* Run `./gradlew build` to build. It also runs all the tests.
91+
* Run `./gradlew <module>:test` to test the module you are looking at to speed
92+
things up during development.
93+
94+
You can import this project into IDEA, but you have to delegate the build actions
95+
to Gradle (in Preferences -> Build, Execution, Deployment -> Build Tools -> Gradle -> Runner)
96+
97+
## Contacting maintainers
98+
99+
* If something cannot be done or doesn't work conveniently &mdash; submit an [issue](#submitting-issues).
100+
* To attract attention to your problem, raise a question, or make a new comment, mention one of us on Github: @koperagen @Jolanrensen @zaleslaw @ileasile
101+
* Discussions and general inquiries &mdash; use `#datascience` channel in [KotlinLang Slack](https://kotl.in/slack).

core/build.gradle.kts

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ val processKDocsMain by creatingProcessDocTask(
7676
COMMENT_DOC_PROCESSOR,
7777
SAMPLE_DOC_PROCESSOR,
7878
)
79-
debug = true
8079
}
8180

8281
// As a bonus, this will update dokka if you use that
@@ -119,27 +118,6 @@ tasks.withType<Jar> {
119118
}
120119
}
121120

122-
123-
tasks.lintKotlinMain {
124-
exclude("**/*keywords*/**")
125-
exclude {
126-
it.name.endsWith(".Generated.kt")
127-
}
128-
exclude {
129-
it.name.endsWith("\$Extensions.kt")
130-
}
131-
}
132-
133-
tasks.lintKotlinTest {
134-
exclude {
135-
it.name.endsWith(".Generated.kt")
136-
}
137-
exclude {
138-
it.name.endsWith("\$Extensions.kt")
139-
}
140-
enabled = true
141-
}
142-
143121
korro {
144122
docs = fileTree(rootProject.rootDir) {
145123
include("docs/StardustDocs/topics/*.md")
@@ -186,6 +164,17 @@ kotlinter {
186164
)
187165
}
188166

167+
tasks.withType<org.jmailen.gradle.kotlinter.tasks.LintTask> {
168+
exclude("**/*keywords*/**")
169+
exclude {
170+
it.name.endsWith(".Generated.kt")
171+
}
172+
exclude {
173+
it.name.endsWith("\$Extensions.kt")
174+
}
175+
enabled = true
176+
}
177+
189178
kotlin {
190179
explicitApi()
191180
}
@@ -196,7 +185,6 @@ tasks.withType<JavaCompile> {
196185
}
197186

198187
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
199-
dependsOn(tasks.lintKotlin)
200188
kotlinOptions {
201189
freeCompilerArgs = freeCompilerArgs + listOf("-Xinline-classes", "-Xopt-in=kotlin.RequiresOptIn")
202190
}

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataFrame.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public interface DataFrame<out T> : Aggregatable<T>, ColumnsContainer<T> {
5757
override operator fun <C> get(columns: ColumnsSelector<T, C>): List<DataColumn<C>> =
5858
getColumnsImpl(UnresolvedColumnsPolicy.Fail, columns)
5959

60-
public operator fun get(first: Column, vararg other: Column): DataFrame<T> = select(listOf(first) + other)
60+
public operator fun get(first: AnyColumnReference, vararg other: AnyColumnReference): DataFrame<T> = select(listOf(first) + other)
6161
public operator fun get(first: String, vararg other: String): DataFrame<T> = select(listOf(first) + other)
6262
public operator fun get(columnRange: ClosedRange<String>): DataFrame<T> =
6363
select { columnRange.start..columnRange.endInclusive }

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataRow.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public interface DataRow<out T> {
2828
public operator fun <R> get(column: ColumnReference<R>): R
2929
public operator fun <R> get(columns: List<ColumnReference<R>>): List<R> = columns.map { get(it) }
3030
public operator fun <R> get(property: KProperty<R>): R = get(property.columnName) as R
31-
public operator fun get(first: Column, vararg other: Column): DataRow<T> = owner.get(first, *other)[index]
31+
public operator fun get(first: AnyColumnReference, vararg other: AnyColumnReference): DataRow<T> = owner.get(first, *other)[index]
3232
public operator fun get(first: String, vararg other: String): DataRow<T> = owner.get(first, *other)[index]
3333
public operator fun get(path: ColumnPath): Any? = owner.get(path)[index]
3434
public operator fun get(name: String): Any?

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aliases.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public typealias RowValueFilter<T, C> = RowValueExpression<T, C, Boolean>
149149

150150
// region columns
151151

152-
public typealias Column = ColumnReference<*>
152+
public typealias AnyColumnReference = ColumnReference<*>
153153

154154
public typealias ColumnGroupReference = ColumnReference<AnyRow>
155155
public typealias ColumnGroupAccessor<T> = ColumnAccessor<DataRow<T>>

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl.kt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
package org.jetbrains.kotlinx.dataframe.api
22

3-
import org.jetbrains.kotlinx.dataframe.*
3+
import org.jetbrains.kotlinx.dataframe.AnyCol
4+
import org.jetbrains.kotlinx.dataframe.AnyColumnReference
5+
import org.jetbrains.kotlinx.dataframe.AnyRow
46
import org.jetbrains.kotlinx.dataframe.ColumnFilter
7+
import org.jetbrains.kotlinx.dataframe.ColumnGroupReference
58
import org.jetbrains.kotlinx.dataframe.ColumnsContainer
69
import org.jetbrains.kotlinx.dataframe.ColumnsSelector
710
import org.jetbrains.kotlinx.dataframe.DataColumn
11+
import org.jetbrains.kotlinx.dataframe.DataFrame
12+
import org.jetbrains.kotlinx.dataframe.DataRow
813
import org.jetbrains.kotlinx.dataframe.Predicate
914
import org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor
1015
import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup
@@ -16,6 +21,7 @@ import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath
1621
import org.jetbrains.kotlinx.dataframe.columns.FrameColumn
1722
import org.jetbrains.kotlinx.dataframe.columns.SingleColumn
1823
import org.jetbrains.kotlinx.dataframe.columns.renamedReference
24+
import org.jetbrains.kotlinx.dataframe.hasNulls
1925
import org.jetbrains.kotlinx.dataframe.impl.columnName
2026
import org.jetbrains.kotlinx.dataframe.impl.columns.ColumnsList
2127
import org.jetbrains.kotlinx.dataframe.impl.columns.DistinctColumnSet
@@ -74,7 +80,7 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum
7480

7581
public operator fun String.rangeTo(endInclusive: String): ColumnSet<*> = toColumnAccessor().rangeTo(endInclusive.toColumnAccessor())
7682

77-
public operator fun Column.rangeTo(endInclusive: Column): ColumnSet<*> = object : ColumnSet<Any?> {
83+
public operator fun AnyColumnReference.rangeTo(endInclusive: AnyColumnReference): ColumnSet<*> = object : ColumnSet<Any?> {
7884
override fun resolve(context: ColumnResolutionContext): List<ColumnWithPath<Any?>> {
7985
val startPath = this@rangeTo.resolveSingle(context)!!.path
8086
val endPath = endInclusive.resolveSingle(context)!!.path
@@ -168,7 +174,7 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum
168174
}
169175

170176
public fun SingleColumn<*>.allAfter(colName: String): ColumnSet<Any?> = allAfter(pathOf(colName))
171-
public fun SingleColumn<*>.allAfter(column: Column): ColumnSet<Any?> = allAfter(column.path())
177+
public fun SingleColumn<*>.allAfter(column: AnyColumnReference): ColumnSet<Any?> = allAfter(column.path())
172178

173179
// endregion
174180

@@ -187,7 +193,7 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum
187193
}
188194

189195
public fun SingleColumn<*>.allSince(colName: String): ColumnSet<Any?> = allSince(pathOf(colName))
190-
public fun SingleColumn<*>.allSince(column: Column): ColumnSet<Any?> = allSince(column.path())
196+
public fun SingleColumn<*>.allSince(column: AnyColumnReference): ColumnSet<Any?> = allSince(column.path())
191197

192198
// endregion
193199

@@ -206,7 +212,7 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum
206212
}
207213

208214
public fun SingleColumn<*>.allBefore(colName: String): ColumnSet<Any?> = allBefore(pathOf(colName))
209-
public fun SingleColumn<*>.allBefore(column: Column): ColumnSet<Any?> = allBefore(column.path())
215+
public fun SingleColumn<*>.allBefore(column: AnyColumnReference): ColumnSet<Any?> = allBefore(column.path())
210216

211217
// endregion
212218

@@ -225,7 +231,7 @@ public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColum
225231
}
226232

227233
public fun SingleColumn<*>.allUntil(colName: String): ColumnSet<Any?> = allUntil(pathOf(colName))
228-
public fun SingleColumn<*>.allUntil(column: Column): ColumnSet<Any?> = allUntil(column.path())
234+
public fun SingleColumn<*>.allUntil(column: AnyColumnReference): ColumnSet<Any?> = allUntil(column.path())
229235

230236
// endregion
231237

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataFrameGet.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package org.jetbrains.kotlinx.dataframe.api
22

33
import org.jetbrains.kotlinx.dataframe.AnyCol
4-
import org.jetbrains.kotlinx.dataframe.Column
4+
import org.jetbrains.kotlinx.dataframe.AnyColumnReference
55
import org.jetbrains.kotlinx.dataframe.ColumnSelector
66
import org.jetbrains.kotlinx.dataframe.ColumnsContainer
77
import org.jetbrains.kotlinx.dataframe.ColumnsSelector
@@ -88,7 +88,7 @@ public fun <T> ColumnsContainer<T>.getColumnGroupOrNull(column: KProperty<*>): C
8888
public fun <C> ColumnsContainer<*>.containsColumn(column: ColumnReference<C>): Boolean = getColumnOrNull(column) != null
8989
public fun ColumnsContainer<*>.containsColumn(column: KProperty<*>): Boolean = containsColumn(column.columnName)
9090

91-
public operator fun ColumnsContainer<*>.contains(column: Column): Boolean = containsColumn(column)
91+
public operator fun ColumnsContainer<*>.contains(column: AnyColumnReference): Boolean = containsColumn(column)
9292
public operator fun ColumnsContainer<*>.contains(column: KProperty<*>): Boolean = containsColumn(column)
9393

9494
// region rows

0 commit comments

Comments
 (0)