typelevel / typelevel/frameless

Iterate over TypedColumns with evidence

Open
#739 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
895
Forks
135
Avg merge
1d 16h
Merged PRs (30d)
3

Description

I was wondering if there was a way to iterate over the columns as Symbols with the appropriate evidence of their existence in the typed dataset, and perhaps some type tagging to ensure the operations for that symbol are type compatible.

My concrete example is the following: I have a dataset for which some columns are String, and want to replace those columns by translated version of their contents. Some (pseudo)code illustrating what I wanted to achieve is

val ds = TypedDataset(...)
ds.columns.foldLeft(ds) { (ds, typedColumn) =>
  typedColumn match {
    case typedColumn: TypedColumn[String] => ds.withColumnReplaced(typedColumn.symbol, translate(typedColumn))
    case _ => ds
  }
}

Is that already possible?

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining the TypedDataset.columns and TypedColumn APIs referenced in the example, along with withColumnReplaced. Determine whether iteration can preserve each column's symbol, type evidence, and type-compatible operations; done means a supported API or clearly defined limitation for the String-column translation use case.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala, spark
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.