`DataFrame.concat(rows)` drops the schema of a zero-row receiver
Los mantenedores suelen responder en 1 día
@Kanish2002 ya está trabajando en esto.
Desde el 11/10/2026.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 48/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Kotlin
- Estrellas
- 1.1k
- Forks
- 87
- Merge medio
- 2 d 21 h
- PR fusionados (30 d)
- 40
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Kotlin/dataframe
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Add `columnOf(vararg DataFrame<T: DataRowSchema>): FrameColumn<T>` overload for compatibilityAbiertoAPI
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Kotlin/dataframe#2202 · 3 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Kotlin/dataframe#2195 · 2 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
AX
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
Los mantenedores suelen responder en 1 día
-
Add minimal KDocs for `print` APIsPosiblemente ocupada @zaleslaw la tomó hace 4 días. AbiertoKDocs
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
Todos los issues de Kotlin/dataframe
Issues similares
-
[Submission] 招商银行Abiertosubmit-adaption submit-adaption-pre
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
BetterAndroid/android-notification-icon-project#848 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
"Tick" is confusingAbiertobug
Dificultad 1/5 1-3 horas Aptitud para principiantes 70/100
orgzly-revived/orgzly-android-revived#1132 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
commons-app/apps-android-commons#7275 ·
Los mantenedores suelen responder en 1 día
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
liberation-data/drivine4j#682 ·
Los mantenedores suelen responder en 1 día
-
documentation good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
developmentwithyash/yaan#14 ·
Los mantenedores suelen responder en 2 días