`DataFrame.concat(rows)` drops the schema of a zero-row receiver
メンテナーはふだん 1 日以内に返信
@Kanish2002 がすでに取り組んでいます。
2026年10月11日 から。
評価
調査の方向性
Start from the DataFrame.concat(rows) implementation shown in the issue ((rows() + rows).concat()), which rebuilds from rows and therefore drops columns when the receiver is empty. Trace how empty frames (DataFrame.emptyOf) store schema versus how row-based concat unifies schemas. Add tests matching the acceptance criteria: empty iterable on emptyOf, and a zero-row receiver plus non-empty rows with a different runtime schema; keep existing non-empty-receiver unification unchanged.
索引モデルが issue の本文から書いたものです。
説明
Description
DataFrame.concat(rows: Iterable<DataRow<T>>) rebuilds the receiver from its rows:
public fun <T> DataFrame<T>.concat(rows: Iterable<DataRow<T>>): DataFrame<T> = (rows() + rows).concat()
Consequently, when the receiver has no rows, it contributes no columns to the result schema. The returned value still
has the static type DataFrame<T>, even though the runtime dataframe may no longer contain the columns declared by T.
How to reproduce
@DataSchema
interface BasicPerson {
val name: String
val age: Int
}
val df: DataFrame<BasicPerson> = dataFrameOf(
"name" to columnOf("Alice", "Bob"),
"age" to columnOf(20, 15),
).cast()
val emptyDf = DataFrame.emptyOf<BasicPerson>()
val result = emptyDf.concat(df.rows().take(0))
println(result.schema()) // []
println(result.age) // compiles, but fails at runtime with IllegalStateException (Column not found: 'age')
Expected behavior
The receiver should participate in schema unification even when it has no rows.
For the example above, result should:
- contain zero rows;
- preserve columns
nameandage; - have the same runtime schema as
emptyDf.
Generally, the receiver's runtime schema should be preserved when rows are appended. If the iterable is non-empty, the result schema should be the union of the receiver's schema and the runtime schemas of the supplied rows.
Acceptance criteria
DataFrame.emptyOf<S>().concat(emptyList<DataRow<S>>())preserves the runtime schema of the receiver.- A zero-row receiver contributes its columns when non-empty rows with a different runtime schema are appended.
- The result contains the receiver rows first, followed by the supplied rows in their iteration order.
- Existing schema-unification and missing-column behavior remains unchanged for non-empty receivers.
- Tests cover both an empty supplied iterable and non-empty supplied rows.
- 主要言語
- Kotlin
- スター
- 1.1k
- フォーク
- 87
- 平均マージ
- 2日 21時間
- マージ済み PR(30日)
- 40
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Kotlin/dataframe のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
API
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
Kotlin/dataframe#2202 · コメント 3 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Kotlin/dataframe#2195 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
AX
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信
-
Add minimal KDocs for `print` APIs対応中かも @zaleslaw が 4 日前に担当しました。 オープンKDocs
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
Kotlin/dataframe の issue をすべて見る
似ている issue
-
[Submission] 招商银行オープンsubmit-adaption submit-adaption-pre
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
BetterAndroid/android-notification-icon-project#848 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
"Tick" is confusingオープンbug
難易度 1/5 1〜3時間 初心者へのやさしさ 70/100
orgzly-revived/orgzly-android-revived#1132 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
commons-app/apps-android-commons#7275 ·
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
liberation-data/drivine4j#682 ·
メンテナーはふだん 1 日以内に返信
-
documentation good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
developmentwithyash/yaan#14 ·
メンテナーはふだん 2 日以内に返信