Repository navigation
Conversation
…e `merge` API, including features like `notNull`, `by`, `asStrings`, `into`, and `intoList`.
…sources** - Added comprehensive documentation for the `merge` API, including features like `notNull`, `by`, `asStrings`, `into`, and `intoList`. - Updated tests to demonstrate various usages of `merge`, including handling heterogeneous columns and transforming merged values. - Included multiple examples for the newly added documentation. - Introduced new HTML resources supporting the `merge` documentation. - Removed outdated `merge` tests in `Modify.kt`, replaced with refined tests in the new `MergeSamples` file. - Updated `build.gradle.kts` to link the new `merge.md` documentation.
Contributor
There was a problem hiding this comment.
Looks good to me — approving! 🎉
Produced by Air Automations. Name: AI Review / Run: https://air.jetbrains.cloud/org/05cf1a7f-6ab5-713b-abd3-29d0c8a05e2d/automations/8daf2412-0b6c-4433-90c0-b40ab5aebcdb?run=0ed70356-ce85-4d90-b3ca-e32f344e01c1
koperagen
reviewed
Nov 4, 2026
…and enrich API references
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #1975
The public
mergeAPIs had no KDoc at all. This PR adds concise KDoc for all 12 non-deprecatedmergeAPIs, with every example backed by a runnable test, and rebuilds themergepage of thedocumentation website to match. Two bugs found while writing the tests are fixed.
Behaviour change
notNull()now applies inintoList()too:df.merge { a and b }.notNull().by(" ").intoList()skipsnull values (before: returned them all).
into(path)now creates missing parent column groups:into(pathOf("person", "fullName"))merges into a new nested group instead of throwingColumn 'fullName' not found among [top-level columns]. Single-segment paths, replacement of existingtargets and the full core suite are unaffected.
Files
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/merge.ktMergeDocsgrammar, shared KoDEx snippets);notNullfilter shared byinto/intoList;into(path)group selection made path-awarecore/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/DocumentationUrls.ktMergewebsite-link entrysamples/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/MergeSamples.kt@samplein the new KDocs and every sample of the rebuilt page, with Sample Helper outputscore/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/merge.ktdocs/StardustDocs/topics/merge.mdtransform, notmerger), full notes incl.notNull/asStrings/into(path), Parameters section, split round-trip exampledocs/StardustDocs/topics/_shadow_resources.md,docs/StardustDocs/resources/api/merge/samples/build.gradle.ktsmerge.mdregistered in the Korro docs configcore/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/Modify.ktmergesample functions deleted — page samples migrated to:samplesProblem 1:
notNull()silently ignored inintoList()df.merge { a and b }.notNull().intoList()returned the unfiltered values, and anall-null column-group row stayed, while
into("col")filtered both.intoList; keep unfiltered and document the exception. Rejected thesecond:
notNullis the documented contract of the merge pipeline, not aninto-only option.filterNotNullAndEmptyRowsused byintoand bothintoListimplementations. For callers:
notNullnow affectsintoListresults.intoList excludes null values when notNull is set,intoList excludes an all-null row value from a column group when notNull is set(both failed before).Problem 2:
into(path)threw for any new nested pathdf.merge { age }.by{}.into(pathOf("person", "fullName"))threwColumn 'fullName' not found among [top-level columns]— also for a new sub-path inside an existinggroup. Only single-segment paths and fully existing nested targets worked.
into(path); pre-create parent groups inunder. Rejected thesecond: the failure is in the convert selector —
getColumnGroup(path)returns an eagerly resolved,path-less
ColumnGroupthat re-resolves by its leaf name only.convert { columnGroup(mergePath) }— a path-aware accessor. For callers: missingintermediate groups are now created instead of an exception.
into a new nested path creates the missing column groups,into a new sub-path inside an existing column group(both threw before).Tests
Before this PR,
mergehad no KDoc-backed examples; behaviour was covered only by a fewtestSets/person2tests. All expected values come from real runs.merge("a", "b")equals the DSL formby(separator, ...)join; null renderingjoinToString; a null value renders asnullnotNullon every final stepintoand inintoList, with the default and with a custom transformby { }contract;asStringsasStrings()equalsby(", ")intotarget handlingMergeSamples(12)@samplein the KDocs and every sample of the website page runs and produces the asserted resultNote for the reviewer
could point to, never explained
notNullorasStrings, called the lambdamergerwhere the APIsays
transform, and had no generated HTML outputs.getColumnGroup(path)returns an eagerly resolved, path-lessColumnGroup; used as a column setinside
select/convertselectors it re-resolves by its leaf name only and breaks nested paths —the path-aware
columnGroup(path)is the correct form there. This was the root cause of Problem 2.DataRow.isEmpty()is used deliberately in the shared filter with@Suppress("DEPRECATION"):its prescribed replacement
values().all { it == null }is not equivalent for row values collectedfrom column groups — a probe showed the filtering invert there (
DataRowImpl.values()is df-based,isEmpty()is owner-based). Should theReplaceWithitself be fixed? Not changed in this PR.