Improve rendering of ColumnGroup #1460
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1245
Swapping
is AnyCol
withis AnyFrame
allows to avoid applyingdataFrameOf()
to aColumnGroup
object whenconvertToDataFrame()
inKotlinNotebookPluginUtils
is called.In that case, a separate

ColumnGroup
object is rendered without the group,which might look a bit unusual, but the reason to implement it is to ensure more intuitive access to the columns (because we can only access columns
a
andb
and notletters
from the code; with the existing approach we would see the groupletters
, but would not be able to access it).Cast

asDataFrame
will leave it without the group being rendered:At the same time, if we convert this

ColumnGroup
object to a dataframe (with the functionpublic fun AnyBaseCol.toDataFrame(): AnyFrame = dataFrameOf(listOf(this))
, which is already present in the library), the group is rendered in the dataframe:This seems to be a correct result because in all cases rendering of the columns conforms to the way we access columns from the code (so the structure of data is reflected correctly), and column groups inside a dataframe are actually shown as groups, which prevents the user from being misled.