`toList()` and `toSequence()` throw with the compiler plugin right after `toDataFrame()`
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Read ToListSamples in samples/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/collectionsInterop/ (the two compiler-plugin cases) and the KDocs plus Interop with Collections docs for toList/toSequence. The failure is that the plugin substitutes a generated type after toDataFrame/add so toList cannot instantiate it. Do not pick an option (deprecate, change the plugin in the Kotlin repo, or a clearer error) until maintainers decide; this is not a one-file first issue.
索引モデルが issue の本文から書いたものです。
説明
What happens
With the Kotlin DataFrame compiler plugin, toDataFrame() on a list of data class instances gives the
result a generated type argument instead of the original class. toList() then tries to create instances
of that generated type, which is not a data class, and throws:
data class Input(val a: Int, val b: Int)
val df = listOf(Input(1, 2)).toDataFrame()
df.toList()
// IllegalArgumentException: `class ...$Input_48` is not a data class.
// `toList`, `toListOf`, `toSequence` and `toSequenceOf` support only data classes.
The same happens after other operations the plugin refines, for example add. Declaring the type
explicitly does not help either:
val df: DataFrame<Input> = listOf(Input(1, 2)).toDataFrame()
// INITIALIZER_TYPE_MISMATCH: expected 'DataFrame<Input>', actual 'DataFrame<Input_48>'
Today the only ways out are df.toListOf<Input>() and df.cast<Input>().toList(). With the plugin,
almost every dataframe has a generated type argument, so toList() and toSequence() are hardly
usable in such projects.
Options
- Deprecate
toList()/toSequence()in favour oftoListOf<T>()/toSequenceOf<T>(). - Make the compiler plugin keep the original class as the type argument after
toDataFrame()
(needs a change in the plugin, in the Kotlin repository). - Give a clearer error message when the type argument is a plugin-generated type, pointing to
toListOf.
Tests
ToListSamples in samples/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/collectionsInterop/
pins the current behaviour:
with the compiler plugin toList throws right after toDataFrame and
with the compiler plugin toList throws after add. The KDocs of toList/toSequence and the toList
and "Interop with Collections" pages describe it; update them when this is fixed.
- 主要言語
- 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
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
[New Rule]zstd-kmpオープン
難易度 1/5 1〜3時間 初心者へのやさしさ 82/100
LibChecker/LibChecker-Rules#1456 ·
-
支持iOS 15.1及以上的系统オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
メンテナーはふだん 1 日以内に返信
-
[Submission] 招商银行オープンsubmit-adaption submit-adaption-pre
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
BetterAndroid/android-notification-icon-project#848 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
pengchujin/aerial-tv#1398 ·
メンテナーはふだん 1 日以内に返信