Skip to content

Commit bdf3ba3

Browse files
committed
updating docs with single
1 parent 4054b2d commit bdf3ba3

File tree

5 files changed

+63
-0
lines changed

5 files changed

+63
-0
lines changed

core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl.kt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ class ColumnsSelectionDslTests : TestBase() {
6363
it.any { it == "Alice" }
6464
}
6565
}
66+
67+
df.select {
68+
"name".last {
69+
it.any { it == "Alice" }
70+
}
71+
} shouldBe df.select { name.firstName }
72+
73+
df.select {
74+
Person::name.last {
75+
it.any { it == "Alice" }
76+
}
77+
} shouldBe df.select { name.firstName }
6678
}
6779

6880
@Test
@@ -85,6 +97,18 @@ class ColumnsSelectionDslTests : TestBase() {
8597
it.any { it == "Alice" }
8698
}
8799
}
100+
101+
df.select {
102+
"name".single {
103+
it.any { it == "Alice" }
104+
}
105+
} shouldBe df.select { name.firstName }
106+
107+
df.select {
108+
Person::name.single {
109+
it.any { it == "Alice" }
110+
}
111+
} shouldBe df.select { name.firstName }
88112
}
89113

90114
}

core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/Access.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,11 @@ class Access : TestBase() {
820820
group("name").last { it.name().endsWith("Name") }
821821
}
822822

823+
// find the single column inside a column group satisfying the condition
824+
df.select {
825+
Person::name.single { it.name().startsWith("first") }
826+
}
827+
823828
// depth-first-search traversal of all columns, excluding ColumnGroups from result
824829
df.select { allDfs() }
825830

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ class ColumnsSelectionDslTests : TestBase() {
6363
it.any { it == "Alice" }
6464
}
6565
}
66+
67+
df.select {
68+
"name".last {
69+
it.any { it == "Alice" }
70+
}
71+
} shouldBe df.select { name.firstName }
72+
73+
df.select {
74+
Person::name.last {
75+
it.any { it == "Alice" }
76+
}
77+
} shouldBe df.select { name.firstName }
6678
}
6779

6880
@Test
@@ -85,6 +97,18 @@ class ColumnsSelectionDslTests : TestBase() {
8597
it.any { it == "Alice" }
8698
}
8799
}
100+
101+
df.select {
102+
"name".single {
103+
it.any { it == "Alice" }
104+
}
105+
} shouldBe df.select { name.firstName }
106+
107+
df.select {
108+
Person::name.single {
109+
it.any { it == "Alice" }
110+
}
111+
} shouldBe df.select { name.firstName }
88112
}
89113

90114
}

core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/Access.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,11 @@ class Access : TestBase() {
820820
group("name").last { it.name().endsWith("Name") }
821821
}
822822

823+
// find the single column inside a column group satisfying the condition
824+
df.select {
825+
Person::name.single { it.name().startsWith("first") }
826+
}
827+
823828
// depth-first-search traversal of all columns, excluding ColumnGroups from result
824829
df.select { allDfs() }
825830

docs/StardustDocs/topics/ColumnSelectors.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,11 @@ df.select {
214214
group("name").last { it.name().endsWith("Name") }
215215
}
216216

217+
// find the single column inside a column group satisfying the condition
218+
df.select {
219+
Person::name.single { it.name().startsWith("first") }
220+
}
221+
217222
// depth-first-search traversal of all columns, excluding ColumnGroups from result
218223
df.select { allDfs() }
219224

0 commit comments

Comments
 (0)