From d3ec65f1b1106c113e2baf48d467f580323f5ff9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 14:33:52 +0000 Subject: [PATCH 1/2] Initial plan From 06cdb5783a8f16da86937ed1523db0774157e874 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 14:41:37 +0000 Subject: [PATCH 2/2] Document thread-safety of Arrays.parallelSort usage Co-authored-by: zaleslaw <1198621+zaleslaw@users.noreply.github.com> --- .../kotlinx/dataframe/jupyter/KotlinNotebookPluginUtils.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/KotlinNotebookPluginUtils.kt b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/KotlinNotebookPluginUtils.kt index 9781af2c90..a5697f6695 100644 --- a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/KotlinNotebookPluginUtils.kt +++ b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/KotlinNotebookPluginUtils.kt @@ -133,6 +133,10 @@ public object KotlinNotebookPluginUtils { val finalComparator = if (isDesc[0]) comparator.reversed() else comparator val permutation = Array(column.size()) { it } + // parallelSort is thread-safe here: the comparator only performs concurrent reads from the column, + // and column.get() is a simple, side-effect-free access to an underlying List. + // Standard List implementations (ArrayList, etc.) are safe for concurrent reads + // as long as there are no concurrent modifications to the dataframe. Arrays.parallelSort(permutation, finalComparator) return SortedDataFrameView(df, permutation.asList()) }