Revisit accessor name generation
- Dominant language
- Kotlin
- Stars
- 1.1k
- Forks
- 83
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 30
Description
Brought to attention by https://github.com/Kotlin/dataframe/issues/911
Column names can contain any symbol. This is important to support reading and writing any format.
Accessors, however, don't support all symbols due to limitations of the JVM.
Identifiers need to follow the spec:
- `(Letter | '_') {Letter | '_' | UnicodeDigit}` is allowed without `` ` ``
- Letter: any unicode character of categories Lu, Ll, Lt, Lm or Lo
- UnicodeDigit: any unicode character of category Nd
- ``'`' QuotedSymbol {QuotedSymbol} '`'``
- any character excluding CR, LF and `` '`' `` (well except the last part, we cannot write `` ` `` inside a name with backticks
- `., ;, [, ], /, <, >, :, \\` are never allowed
Source: https://kotlinlang.org/spec/syntax-and-grammar.html#identifiers
To support `QuotedSymbol` characters, our generator automatically inserts backticks where needed.
For disallowed characters, we use the following conversion:

This conversion makes it so that columns from data will be accessible like:
- "my::colName" -> `` df.`my - colName` ``
- "Dwayne \`The Rock\` Johnson" -> `` df.`Dwayne 'The Rock' Johnson` ``
- "name.first" -> `` df.`name first` ``
These conversions are defined to cause as little clashes as possible, but there are some confusing choices.
For instance, "." becoming " ", instead of "_".
This needs some research and feedback.
Contributor guide
Research direction
No source file, test, or generator entry point is named. Start by locating the accessor name-generation code, then review the Kotlin identifier specification and issue 911; done means the conversion rules are researched, agreed on, and reflected consistently in generated accessors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100