Skip to content

Split by operation on "normal classes" could be clearer #488

Description

@Jolanrensen

I was working with a LocalDateTime which I wanted to split up into a LocalDate and a LocalTime column. I found the split operation, but it wasn't immediately obvious how to work with this. For splitting a column up based on String delimiters, something like

df.split { stringCol }.by { it.split(",") }.into("first", "second")

is clear and works well. However, when trying to split up a LocalDateTime:

df.split { localDateTimeCol }.by { listOf(it.date, it.time) }.into("date", "time")

does not seem obvious.

Something like

df.split { localDateTimeCol }.by { it.date and it.time }.into("date", "time")

would improve it a bit, and

df.split { localDateTimeCol }.by { 
  it.date into "date"
  it.time into "time"
}

even more.

(Btw, since Split is a public data class, you're able to call df.split { myCol }.copy { } which looks like it should be prohibited)

Metadata

Metadata

Assignees

Labels

APIIf it touches our APIenhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions