Skip to content

Commit 891a37e

Browse files
Automated commit of generated code
1 parent 529391f commit 891a37e

11 files changed

Lines changed: 43 additions & 40 deletions

File tree

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/DataFrameImpl.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import org.jetbrains.kotlinx.dataframe.DataColumn
88
import org.jetbrains.kotlinx.dataframe.DataFrame
99
import org.jetbrains.kotlinx.dataframe.DataRow
1010
import org.jetbrains.kotlinx.dataframe.aggregation.AggregateGroupedBody
11+
import org.jetbrains.kotlinx.dataframe.annotations.AccessApiOverload
1112
import org.jetbrains.kotlinx.dataframe.api.asColumnGroup
1213
import org.jetbrains.kotlinx.dataframe.api.asDataColumn
1314
import org.jetbrains.kotlinx.dataframe.api.cast
@@ -25,6 +26,7 @@ import org.jetbrains.kotlinx.dataframe.impl.aggregation.AggregatableInternal
2526
import org.jetbrains.kotlinx.dataframe.impl.aggregation.GroupByReceiverImpl
2627
import org.jetbrains.kotlinx.dataframe.impl.columns.resolveSingle
2728
import org.jetbrains.kotlinx.dataframe.io.renderToString
29+
import org.jetbrains.kotlinx.dataframe.util.DEPRECATED_ACCESS_API
2830
import kotlin.reflect.KProperty
2931

3032
internal const val UNNAMED_COLUMN_PREFIX = "untitled"
@@ -126,9 +128,13 @@ internal open class DataFrameImpl<T>(cols: List<AnyCol>, val nrow: Int) :
126128
selector = column,
127129
).singleOrNull()
128130

131+
@Deprecated(DEPRECATED_ACCESS_API)
132+
@AccessApiOverload
129133
override fun <R> getColumnOrNull(column: ColumnReference<R>): DataColumn<R>? =
130134
column.resolveSingle(this, UnresolvedColumnsPolicy.Skip)?.data
131135

136+
@Deprecated(DEPRECATED_ACCESS_API)
137+
@AccessApiOverload
132138
override fun <R> getColumnOrNull(column: KProperty<R>): DataColumn<R>? = getColumnOrNull(column.toColumnAccessor())
133139

134140
override fun getColumnOrNull(path: ColumnPath): AnyCol? =

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/columns/DataColumnImpl.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ internal abstract class DataColumnImpl<T>(
3030

3131
this.isPrimitiveArray ->
3232
type.isPrimitiveArray &&
33-
this!!::class.qualifiedName == type.classifier?.let { (it as KClass<*>).qualifiedName }
33+
this::class.qualifiedName == type.classifier?.let { (it as KClass<*>).qualifiedName }
3434

3535
this.isArray -> type.isArray
3636

3737
// cannot check the precise type of array
38-
else -> this!!::class.isSubclassOf(type.classifier as KClass<*>)
38+
else -> this::class.isSubclassOf(type.classifier as KClass<*>)
3939
}
4040

4141
init {
4242
// Check for [Issue #713](https://github.com/Kotlin/dataframe/issues/713).
4343
// This only runs with `kotlin.dataframe.debug=true` in gradle.properties.
4444
if (BuildConfig.DEBUG) {
4545
require(values.all { it matches type }) {
46-
val types = values.map { if (it == null) "Nothing?" else it!!::class.simpleName }.distinct()
46+
val types = values.map { if (it == null) "Nothing?" else it::class.simpleName }.distinct()
4747
"Values of $kind '$name' have types '$types' which are not compatible given with column type '$type'"
4848
}
4949
}

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/schema/Utils.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ internal fun ColumnSchema.createEmptyColumn(name: String): AnyCol =
116116
is ColumnSchema.Value -> DataColumn.createValueColumn<Any?>(name, emptyList(), type)
117117
is ColumnSchema.Group -> DataColumn.createColumnGroup(name, schema.createEmptyDataFrame()) as AnyCol
118118
is ColumnSchema.Frame -> DataColumn.createFrameColumn<Any?>(name, emptyList(), lazyOf(schema))
119-
else -> error("Unexpected ColumnSchema: $this")
120119
}
121120

122121
/**
@@ -146,8 +145,6 @@ internal fun ColumnSchema.createNullFilledColumn(name: String, numberOfRows: Int
146145
groups = List(numberOfRows) { emptyDataFrame<Any?>() },
147146
schema = lazyOf(schema),
148147
)
149-
150-
else -> error("Cannot create null-filled column of unexpected ColumnSchema: $this")
151148
}
152149

153150
internal fun DataFrameSchema.createEmptyDataFrame(): AnyFrame =

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class AllExceptTests : ColumnsSelectionDslTests() {
4343
}
4444

4545
@Test
46-
fun `exceptions`() {
46+
fun exceptions() {
4747
shouldThrow<IllegalStateException> {
4848
dfGroup.select {
4949
name.firstName.allColsExcept("firstName"["secondName"])

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import org.junit.Test
99
class FilterTests : ColumnsSelectionDslTests() {
1010

1111
@Test
12-
fun `filter`() {
12+
fun filter() {
1313
listOf(
1414
df.select { cols(name, age, weight) },
1515
df.select { all().filter { "e" in it.name() } },

core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/ShortNamesRenderingTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ internal class ShortNamesRenderingTest : TypeRenderingStrategy by ShortNames {
7878
}
7979

8080
@Test
81-
fun `dataframe`() {
81+
fun dataframe() {
8282
fields.keys.asClue {
8383
fields["f"]!!.renderAccessorFieldType() shouldBe
8484
"DataFrame<org.jetbrains.kotlinx.dataframe.internal.codeGen.ShortNamesRenderingTest.Marker>"

core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/io/PlaylistJsonTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ class PlaylistJsonTest {
193193
}
194194

195195
@Test
196-
fun `union`() {
196+
fun union() {
197197
val merged = item.concat(item)
198198
merged.rowsCount() shouldBe item.rowsCount() * 2
199199
val group = merged.snippet

core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/statistics/cumsum.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class CumsumTests {
7979
}
8080

8181
@Test
82-
fun `groupBy`() {
82+
fun groupBy() {
8383
val df = dataFrameOf("str", "col")(
8484
"a", 1,
8585
"b", 2,

core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/testSets/person/DataFrameTests.kt

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ class DataFrameTests : BaseTest() {
257257
}
258258

259259
@Test
260-
fun `toMap`() {
260+
fun toMap() {
261261
val map = df.toMap()
262262
map.size shouldBe 4
263263
map.forEach {
@@ -266,19 +266,19 @@ class DataFrameTests : BaseTest() {
266266
}
267267

268268
@Test
269-
fun `size`() {
269+
fun size() {
270270
df.size() shouldBe DataFrameSize(df.ncol, df.nrow)
271271
}
272272

273273
@Test
274-
fun `slicing`() {
274+
fun slicing() {
275275
val sliced = typed[1..2]
276276
sliced.nrow shouldBe 2
277277
sliced[0].name shouldBe typed[1].name
278278
}
279279

280280
@Test
281-
fun `indexing`() {
281+
fun indexing() {
282282
val expected = 45
283283
val i = 1
284284

@@ -333,7 +333,7 @@ class DataFrameTests : BaseTest() {
333333
}
334334

335335
@Test
336-
fun `chunked`() {
336+
fun chunked() {
337337
val res = df.chunked(2)
338338
res.size() shouldBe 4
339339
res.toList().dropLast(1).forEach {
@@ -342,7 +342,7 @@ class DataFrameTests : BaseTest() {
342342
}
343343

344344
@Test
345-
fun `update`() {
345+
fun update() {
346346
fun AnyFrame.check() {
347347
getColumn(1).name() shouldBe "age"
348348
ncol shouldBe typed.ncol
@@ -423,7 +423,7 @@ class DataFrameTests : BaseTest() {
423423
}
424424

425425
@Test
426-
fun `resetToNull`() {
426+
fun resetToNull() {
427427
val updated = typed.update { all() }.withNull()
428428

429429
updated.columns().forEach {
@@ -432,7 +432,7 @@ class DataFrameTests : BaseTest() {
432432
}
433433

434434
@Test
435-
fun `sort`() {
435+
fun sort() {
436436
val expected = listOf(null, "London", "Dubai", "Tokyo", "Milan", "Moscow", "Moscow")
437437

438438
fun AnyFrame.check() = this[city].toList() shouldBe expected
@@ -472,7 +472,7 @@ class DataFrameTests : BaseTest() {
472472
}
473473

474474
@Test
475-
fun `equals`() {
475+
fun equals() {
476476
typed shouldBe typed.update { age }.with { age }
477477
}
478478

@@ -504,7 +504,7 @@ class DataFrameTests : BaseTest() {
504504
}
505505

506506
@Test
507-
fun `filter`() {
507+
fun filter() {
508508
val expected = listOf("Bob", "Bob", "Charlie")
509509

510510
fun AnyFrame.check() = this[name].toList() shouldBe expected
@@ -703,7 +703,7 @@ class DataFrameTests : BaseTest() {
703703
}
704704

705705
@Test
706-
fun `groupBy`() {
706+
fun groupBy() {
707707
fun AnyFrame.check() {
708708
nrow shouldBe 3
709709
this["name"].toList() shouldBe listOf("Alice", "Bob", "Charlie")
@@ -792,7 +792,7 @@ class DataFrameTests : BaseTest() {
792792
}
793793

794794
@Test
795-
fun `min`() {
795+
fun min() {
796796
val expected = 15
797797

798798
fun Any?.check() = this shouldBe expected
@@ -848,7 +848,7 @@ class DataFrameTests : BaseTest() {
848848
}
849849

850850
@Test
851-
fun `maxBy`() {
851+
fun maxBy() {
852852
val expected = "Bob"
853853

854854
fun AnyRow?.check() = this!![name] shouldBe expected
@@ -998,7 +998,7 @@ class DataFrameTests : BaseTest() {
998998
}
999999

10001000
@Test
1001-
fun `distinct`() {
1001+
fun distinct() {
10021002
val expected = 6
10031003
typed.countDistinct { name and city } shouldBe expected
10041004
typed.select { name and city }.distinct().nrow shouldBe expected
@@ -1018,7 +1018,7 @@ class DataFrameTests : BaseTest() {
10181018
}
10191019

10201020
@Test
1021-
fun `addRow`() {
1021+
fun addRow() {
10221022
val res = typed.append("Bob", null, "Paris", null)
10231023
res.nrow shouldBe typed.nrow + 1
10241024
res.name.type() shouldBe typeOf<String>()
@@ -1034,7 +1034,7 @@ class DataFrameTests : BaseTest() {
10341034
}
10351035

10361036
@Test
1037-
fun `rename`() {
1037+
fun rename() {
10381038
fun AnyFrame.check() {
10391039
this["name2"].toList() shouldBe typed.name.toList()
10401040
this["age2"].toList() shouldBe typed.age.toList()
@@ -1053,7 +1053,7 @@ class DataFrameTests : BaseTest() {
10531053
}
10541054

10551055
@Test
1056-
fun `nunique`() {
1056+
fun nunique() {
10571057
typed.name.countDistinct() shouldBe 3
10581058
}
10591059

@@ -1486,7 +1486,7 @@ class DataFrameTests : BaseTest() {
14861486
}
14871487

14881488
@Test
1489-
fun `forEachIn`() {
1489+
fun forEachIn() {
14901490
val pivoted = typed.pivot(inward = true) { city }.groupBy { name and weight }.with { age }
14911491
val sum = pivoted
14921492
.select { "city".allCols() }
@@ -1497,7 +1497,7 @@ class DataFrameTests : BaseTest() {
14971497
}
14981498

14991499
@Test
1500-
fun `parse`() {
1500+
fun parse() {
15011501
val toStr = typed.convert { weight }.notNull { it.toString() }
15021502
val weightStr = "weight".toColumnOf<String?>()
15031503
val parsed = toStr.convert { weightStr }.toInt()
@@ -2190,7 +2190,7 @@ class DataFrameTests : BaseTest() {
21902190
}
21912191

21922192
@Test
2193-
fun `isNumber`() {
2193+
fun isNumber() {
21942194
typed.age.isNumber() shouldBe true
21952195
typed.weight.isNumber() shouldBe true
21962196

core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/testSets/person/DataFrameTreeTests.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class DataFrameTreeTests : BaseTest() {
185185
}
186186

187187
@Test
188-
fun `selects`() {
188+
fun selects() {
189189
df2.select { nameAndCity.allCols() } shouldBe typed2.nameAndCity.select { all() }
190190
df2.select { nameAndCity.cols { !it.hasNulls() } } shouldBe typed2.select { nameAndCity.name }
191191
df2.select { nameAndCity.cols(0..1) } shouldBe typed2.nameAndCity.select { all() }
@@ -237,47 +237,47 @@ class DataFrameTreeTests : BaseTest() {
237237
}
238238

239239
@Test
240-
fun `slice`() {
240+
fun slice() {
241241
val expected = typed[0..2].name
242242
val actual = typed2[0..2].nameAndCity.name
243243
actual shouldBe expected
244244
}
245245

246246
@Test
247-
fun `filter`() {
247+
fun filter() {
248248
val expected = typed.filter { city == null }.select { weight }
249249
typed2.filter { nameAndCity.city == null }.select { weight } shouldBe expected
250250
df2.filter { it[nameAndCity][city] == null }.select { weight } shouldBe expected
251251
}
252252

253253
@Test
254-
fun `select`() {
254+
fun select() {
255255
val expected = typed.select { name and age }
256256
typed2.select { nameAndCity.name and age } shouldBe expected
257257
df2.select { it[nameAndCity][name] and age } shouldBe expected
258258
}
259259

260260
@Test
261-
fun `sort`() {
261+
fun sort() {
262262
val expected = typed.sortBy { name and age }.moveTo(1) { city }
263263
typed2.sortBy { nameAndCity.name and age }.ungroup { nameAndCity } shouldBe expected
264264
}
265265

266266
@Test
267-
fun `move`() {
267+
fun move() {
268268
val actual = typed2.move { nameAndCity.name }.into { pathOf("name") }
269269
actual.columnNames() shouldBe listOf("nameAndCity", "name", "age", "weight")
270270
actual.getColumnGroup("nameAndCity").columnNames() shouldBe listOf("city")
271271
}
272272

273273
@Test
274-
fun `groupBy`() {
274+
fun groupBy() {
275275
val expected = typed.groupBy { name }.max { age }
276276
typed2.groupBy { nameAndCity.name }.max { age } shouldBe expected
277277
}
278278

279279
@Test
280-
fun `distinct`() {
280+
fun distinct() {
281281
val duplicated = typed2.concat(typed2)
282282
duplicated.rowsCount() shouldBe typed2.rowsCount() * 2
283283
val dist = duplicated.nameAndCity.distinct()

0 commit comments

Comments
 (0)