Kotlin / Kotlin/dataframe

Add cast shortcuts for Split

Open
#1,542 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Kotlin
Stars
1.1k
Forks
83
Avg merge
4d 12h
Merged PRs (30d)
30

Description

**Problem**:
This will work:
```kt
df.split { myIterable }
.into("a", "b")
```

This will not work:
```kt
df.split { first() }
.into("a", "b")
```

**Current approach**:
We have special into/inward overloads for types with reasonable default "by": AnyFrame, Iterable, Pair.
Now to make above example compile there are two options
```kt
df.split { first() }
.cast>()
.into("a", "b")
```
or
```kt
df.split { first().cast>() }
.into("a", "b")
```
Both are common approaches in library and can be used for other operations. But could it be that they are not well known or hard to find / easy to miss?

**Suggestion**:
I think maybe for Split confusion with type is more apparent. into/inward functions that you expect are simply not there..?
So 3 shortcuts could be useful for discoverability:
```kt
df.split { first() }
.asIterable()
.into("a", "b")
```

```kt
df.split { first() }
.asPair()
.into("a", "b")
```

```kt
df.split { first() }
.asDataFrame()
.into("a", "b")
```

into/inward only work for non-null List, Pair, AnyFrame so these 3 should be enough.

**Concerns**:
Need compiler plugin support, but looks like usual `cast` is not `Interpretable` either

Contributor guide

Open the contributing guide

Research direction

Start by examining the existing cast, into, and inward APIs and how compiler-plugin support is handled for them. Check whether the proposed asIterable(), asPair(), and asDataFrame() shortcuts can be interpreted like the relevant operations. Done means the three Split examples compile and provide the expected into behavior, with coverage for each shortcut.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.