Kotlin / Kotlin/dataframe

Add unit tests for `concat` APIs

Open
#1,958 0 comments 0 reactions 1 assignee View on GitHub

@Allex-Nik is already working on this.

Since Sep 10, 2026.

tests
Dominant language
Kotlin
Stars
1.1k
Forks
83
Avg merge
4d 12h
Merged PRs (30d)
30

Description

Add unit tests for concat APIs

Now it's only 10-15% of lines and methods are covered

core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/concat.kt currently covers only a small subset of concat behavior.

The implementation in core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/concat.kt contains multiple public overloads, and the site page lists several supported use cases:
https://kotlin.github.io/dataframe/concat.html

Add focused unit tests for the main overload groups and documented behavior.

Test scenarios as an option
DataFrame.concat
  • df.concat(df1, df2) appends rows from multiple dataframes.
  • df1 concat df2 appends rows from another dataframe.
  • df.concat(frames: Iterable<DataFrame<T>>) appends rows from an iterable of dataframes.
  • Concatenating dataframes with the same schema preserves column names, values, and row order.
  • Concatenating dataframes with different schemas performs schema unification.
  • Missing columns are filled with null.
  • Columns with the same name and different compatible types are unified to the lowest common type.
  • Concatenating with an empty dataframe preserves the expected schema and rows.
  • Concatenating dataframes with no columns preserves row count correctly.
DataColumn.concat
  • column.concat(other) appends values from another column.
  • column.concat(col1, col2) appends values from multiple columns.
  • The resulting column keeps the name of the first column.
  • Columns with compatible but different value types are unified correctly.
  • Concatenating with an empty column preserves expected values and type.
  • DataColumn<DataFrame<T>>.concat() concatenates all dataframes stored in a frame column.
  • DataColumn<Iterable<T>>.concat() flattens iterable values into a single list.
DataRow.concat
  • row.concat(row1, row2) creates a dataframe from the receiver row and provided rows.
  • Row order is preserved.
  • Rows with the same schema are concatenated correctly.
  • Rows with different schemas are unified consistently with dataframe concat.
Iterable.concat
  • Iterable<DataFrame<T>>.concat() concatenates all dataframes in order.
  • Empty iterable of dataframes returns an empty dataframe.
  • Iterable<DataColumn<T>>.concat() concatenates all columns in order.
  • Empty iterable of columns returns an empty column.
  • Iterable<DataRow<T>?>.concat() creates a dataframe from rows.
  • null rows in Iterable<DataRow<T>?>.concat() produce empty rows with one row, according to current implementation.
GroupBy.concat
  • groupBy.concat() concatenates groups back into a dataframe.
  • Group keys are not added as separate columns.
  • Row order follows group order.
  • Existing columns with the same names as key columns are preserved as group columns.
GroupBy.concatWithKeys
  • groupBy.concatWithKeys() concatenates groups and adds missing key columns.
  • Key column values are repeated for every row in the corresponding group.
  • Key columns that already exist inside groups are not overwritten.
  • Result values are checked, not only column names.
ReducedGroupBy.concat
  • reducedGroupBy.concat() applies the reducer to each group and concatenates the produced dataframes.
  • Result preserves reducer output order and schema.
Acceptance criteria
  • concat.kt tests cover every public overload group from concat.kt.
  • Tests cover all use cases listed on https://kotlin.github.io/dataframe/concat.html.
  • Schema unification behavior is covered, including missing columns filled with null.
  • GroupBy.concat() and GroupBy.concatWithKeys() are both tested with actual values.
  • Existing empty-dataframe tests are preserved and extended where needed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.