You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by al...@apache.org on 2026/08/28 00:51:04 UTC

(asterixdb) branch master updated: [ASTERIXDB-3785][COMP] Add CLUSTER BY 'seed' option

This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git


The following commit(s) were added to refs/heads/master by this push:
     new cb09a665eb [ASTERIXDB-3785][COMP] Add CLUSTER BY 'seed' option
cb09a665eb is described below

commit cb09a665ebfeba41cb7ddca4dded64b07a5f4060
Author: Le0shy <le...@gmail.com>
AuthorDate: Wed Aug 26 02:26:07 2026 -0700

    [ASTERIXDB-3785][COMP] Add CLUSTER BY 'seed' option
    
    - user model changes: yes
    - storage format changes: no
    - interface changes: yes
    
    Details: A K-Means-only WITH option that pins the randomized choices in the
    initialization, so a seeded query returns the same clusters on every run; without
    it nothing changes. kmeans-recluster takes the seed as a third argument, so its
    arity goes from 2 to 3, and getAlgorithm() returns a canonical name so that both
    spellings of k-means accept the option.
    
    Ext-ref: MB-72552
    Change-Id: I2ca87353a7ee0f37cf49281f1949098fe8dc3879
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21614
    Reviewed-by: Shahrzad Shirazi <sh...@ucr.edu>
    Reviewed-by: Hongyu Shi <le...@gmail.com>
    Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
---
 .../physical/KMeansReclusterPOperator.java         |  2 +-
 .../SqlppExpressionToPlanTranslator.java           | 10 ++-
 .../cluster-by/kmeans-limit-input-validate.plan    |  4 +-
 .../cluster-by/kmeans-syntax-full-validate.plan    |  4 +-
 .../results/cluster-by/kmeans-syntax-validate.plan |  4 +-
 .../queries_sqlpp/cluster-by/ClusterByQueries.xml  | 25 ++++++++
 .../cluster-by/kmeans-seed/kmeans-seed.1.ddl.sqlpp | 29 +++++++++
 .../kmeans-seed/kmeans-seed.2.update.sqlpp         | 27 ++++++++
 .../kmeans-seed/kmeans-seed.3.query.sqlpp          | 29 +++++++++
 .../kmeans-seed/kmeans-seed.4.query.sqlpp          | 28 ++++++++
 .../kmeans-seed/kmeans-seed.5.query.sqlpp          | 28 ++++++++
 .../negative/seed-not-integer/test.1.query.sqlpp   | 24 +++++++
 .../seed-out-of-int-range/test.1.query.sqlpp       | 24 +++++++
 .../test.1.query.sqlpp                             | 24 +++++++
 .../cluster-by/kmeans-seed/kmeans-seed.3.adm       | 64 +++++++++++++++++++
 .../cluster-by/kmeans-seed/kmeans-seed.4.adm       | 64 +++++++++++++++++++
 .../cluster-by/kmeans-seed/kmeans-seed.5.adm       | 64 +++++++++++++++++++
 .../cluster-by/kmeans-seed/kmeans-seed.3.adm       | 64 +++++++++++++++++++
 .../cluster-by/kmeans-seed/kmeans-seed.4.adm       | 64 +++++++++++++++++++
 .../cluster-by/kmeans-seed/kmeans-seed.5.adm       | 64 +++++++++++++++++++
 .../rewrites/visitor/SqlppClusterByVisitor.java    | 74 ++++++++++++++++------
 .../asterix/om/functions/BuiltinFunctions.java     | 14 +---
 .../kmeans/KMeansReclusterOperatorDescriptor.java  | 17 ++---
 .../kmeans/KMeansReclusterOperatorTest.java        |  9 ++-
 .../visitors/IsomorphismOperatorVisitor.java       |  4 ++
 .../LogicalOperatorPrettyPrintVisitor.java         |  6 +-
 .../LogicalOperatorPrettyPrintVisitorJson.java     |  1 +
 .../core/utils/LogicalOperatorDotVisitor.java      |  5 +-
 28 files changed, 717 insertions(+), 59 deletions(-)

diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/KMeansReclusterPOperator.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/KMeansReclusterPOperator.java
index 72d581c229..ec3f6b369c 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/KMeansReclusterPOperator.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/KMeansReclusterPOperator.java
@@ -68,7 +68,7 @@ public class KMeansReclusterPOperator extends AbstractKMeansStagePOperator {
                 JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op), propagatedSchema, context);
         int poolColumn = resolveSingleColumn(inputSchemas[0], kop.getPoolVariable());
         KMeansReclusterOperatorDescriptor mergeDesc = new KMeansReclusterOperatorDescriptor(builder.getJobSpec(),
-                recDesc, kop.getTopCount(), poolColumn, framesLimit());
+                recDesc, kop.getTopCount(), poolColumn, framesLimit(), kop.getSeed());
         contributeOpDesc(builder, (AbstractLogicalOperator) op, mergeDesc);
         builder.contributeGraphEdge(op.getInputs().get(0).getValue(), 0, op, 0);
     }
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
index e95ad3d660..dc55a969df 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
@@ -296,7 +296,7 @@ public class SqlppExpressionToPlanTranslator extends LangExpressionToPlanTransla
                     "not a CLUSTER BY stage marker: " + sig);
         }
         boolean merge = mode == KMeansStageOperator.Mode.RECLUSTER;
-        // Argument layout: merge = (pool, count); loop = (vectors, pool, count[, rounds, seedBase]).
+        // Argument layout: merge = (pool, count, seed); loop = (vectors, pool, count[, rounds, seedBase]).
         Pair<ILogicalOperator, LogicalVariable> vecBranch =
                 merge ? null : translateStreamBranch((SelectExpression) fcall.getExprList().get(0));
         Expression poolArg = fcall.getExprList().get(merge ? 0 : 1);
@@ -336,7 +336,13 @@ public class SqlppExpressionToPlanTranslator extends LangExpressionToPlanTransla
             kop.setLoopRounds((int) longArg(fcall, 3));
             kop.setDimension((int) longArg(fcall, 4));
         }
-        // RECLUSTER takes no width: it reads envelopes whose vectors the loop stages already decoded.
+        // RECLUSTER reads the oversampling loop's output rows -- [kind, partition, seq, score, vec] tuples whose
+        // vectors that loop already decoded and width-checked -- so unlike the loop stages it needs no declared
+        // dimension. Its 3rd argument is the seed for its weighted k-means++ draw, the last randomized choice in
+        // the initialization, and it lands on the same operator field OVERSAMPLE_LOOP sets above.
+        if (mode == KMeansStageOperator.Mode.RECLUSTER) {
+            kop.setSeed(longArg(fcall, 2));
+        }
         kop.setSourceLocation(loc);
         // Input order: loop = vectors (0) then pool (1); merge = pool only (0).
         if (vecBranch != null) {
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-limit-input-validate.plan b/asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-limit-input-validate.plan
index 201c270875..dd3e4ea95f 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-limit-input-validate.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-limit-input-validate.plan
@@ -101,11 +101,11 @@ distribute result [$$244]
                                                               -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
                                 exchange
                                 -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                  kmeans-stage $$225 <- recluster pool $$223 to 2 means
+                                  kmeans-stage $$225 <- recluster pool $$223 to 2 means (seed 12345)
                                   -- KMEANS_RECLUSTER  |PARTITIONED|
                                     exchange
                                     -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                      kmeans-stage $$223 <- oversample-loop 5 rounds of $$208 vs seed $$214
+                                      kmeans-stage $$223 <- oversample-loop 5 rounds of $$208 vs seed $$214 (seed 1000003)
                                       -- KMEANS_OVERSAMPLE_LOOP  |PARTITIONED|
                                         exchange
                                         -- RANDOM_PARTITION_EXCHANGE  |PARTITIONED|
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-syntax-full-validate.plan b/asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-syntax-full-validate.plan
index bb1ecb8450..d3886288d3 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-syntax-full-validate.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-syntax-full-validate.plan
@@ -77,11 +77,11 @@ distribute result [$$191]
                                                                       -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
                                         exchange
                                         -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                          kmeans-stage $$171 <- recluster pool $$169 to 5 means
+                                          kmeans-stage $$171 <- recluster pool $$169 to 5 means (seed 12345)
                                           -- KMEANS_RECLUSTER  |PARTITIONED|
                                             exchange
                                             -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                              kmeans-stage $$169 <- oversample-loop 5 rounds of $$154 vs seed $$160
+                                              kmeans-stage $$169 <- oversample-loop 5 rounds of $$154 vs seed $$160 (seed 1000003)
                                               -- KMEANS_OVERSAMPLE_LOOP  |PARTITIONED|
                                                 exchange
                                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-syntax-validate.plan b/asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-syntax-validate.plan
index b49c24756e..dfaeee8f9f 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-syntax-validate.plan
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-syntax-validate.plan
@@ -80,11 +80,11 @@ distribute result [$$190]
                                                                     -- EMPTY_TUPLE_SOURCE  |PARTITIONED|
                                         exchange
                                         -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                          kmeans-stage $$168 <- recluster pool $$166 to 2 means
+                                          kmeans-stage $$168 <- recluster pool $$166 to 2 means (seed 12345)
                                           -- KMEANS_RECLUSTER  |PARTITIONED|
                                             exchange
                                             -- BROADCAST_EXCHANGE  |PARTITIONED|
-                                              kmeans-stage $$166 <- oversample-loop 5 rounds of $$153 vs seed $$157
+                                              kmeans-stage $$166 <- oversample-loop 5 rounds of $$153 vs seed $$157 (seed 1000003)
                                               -- KMEANS_OVERSAMPLE_LOOP  |PARTITIONED|
                                                 exchange
                                                 -- ONE_TO_ONE_EXCHANGE  |PARTITIONED|
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/ClusterByQueries.xml b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/ClusterByQueries.xml
index bd7f50e6eb..ccf8be08c7 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/ClusterByQueries.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/ClusterByQueries.xml
@@ -175,6 +175,31 @@
             <output-dir compare="Text">kmeans-budget-sensitivity</output-dir>
         </compilation-unit>
     </test-case>
+    <!-- The 'seed' option, over the structureless budget fixture: seed 42, a second seed that must land
+         elsewhere, and a negative seed. -->
+    <test-case FilePath="cluster-by">
+        <compilation-unit name="kmeans-seed">
+            <output-dir compare="Text">kmeans-seed</output-dir>
+        </compilation-unit>
+    </test-case>
+    <test-case FilePath="cluster-by/negative">
+        <compilation-unit name="seed-not-integer">
+            <output-dir compare="Text">seed-not-integer</output-dir>
+            <expected-error>CLUSTER BY 'seed' must be a 32-bit integer, but was: abc</expected-error>
+        </compilation-unit>
+    </test-case>
+    <test-case FilePath="cluster-by/negative">
+        <compilation-unit name="seed-with-unsupported-algorithm">
+            <output-dir compare="Text">seed-with-unsupported-algorithm</output-dir>
+            <expected-error>Unsupported CLUSTER BY 'clustering_algorithm' 'DBSCAN'</expected-error>
+        </compilation-unit>
+    </test-case>
+    <test-case FilePath="cluster-by/negative">
+        <compilation-unit name="seed-out-of-int-range">
+            <output-dir compare="Text">seed-out-of-int-range</output-dir>
+            <expected-error>CLUSTER BY 'seed' must be a 32-bit integer, but was: 2147483648</expected-error>
+        </compilation-unit>
+    </test-case>
     <!-- The budget knob is live: below the declared 4-frame minimum the query is rejected before it
          runs. This is what keeps kmeans-budget-sensitivity honest, since an unregistered or ignored
          `compiler.clusterbymemory` would leave every arm at the default budget, agreeing trivially. -->
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/kmeans-seed/kmeans-seed.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/kmeans-seed/kmeans-seed.1.ddl.sqlpp
new file mode 100644
index 0000000000..f64a725308
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/kmeans-seed/kmeans-seed.1.ddl.sqlpp
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+-- CLUSTER BY 'seed'. Fixture: kmeans-budget-sensitivity's 2000 distinct 128-d vectors, which have no
+-- cluster structure, so the result is decided by the seeded draws rather than by an obvious clustering.
+drop dataverse test if exists;
+create dataverse test;
+use test;
+
+create type PT as closed {
+  id : bigint,
+  vec : [double]
+};
+create dataset Points(PT) primary key id;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/kmeans-seed/kmeans-seed.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/kmeans-seed/kmeans-seed.2.update.sqlpp
new file mode 100644
index 0000000000..103a7296a7
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/kmeans-seed/kmeans-seed.2.update.sqlpp
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+-- 2000 x 128 doubles would be a ~2 MB data file.
+use test;
+
+insert into Points (
+  select value { "id": i,
+                 "vec": (select value (((i * 37 + d * 101 + (i*d) % 71) % 1000) / 1000.0)
+                         from range(0, 127) as d) }
+  from range(1, 2000) as i
+);
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/kmeans-seed/kmeans-seed.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/kmeans-seed/kmeans-seed.3.query.sqlpp
new file mode 100644
index 0000000000..e7f7e70582
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/kmeans-seed/kmeans-seed.3.query.sqlpp
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+-- Seed 42. Pins all three seeded choices at once: the initial-centre row key, the oversampling draws
+-- and RECLUSTER's roulette. A leak at any of them changes the membership.
+use test;
+
+from Points as p
+cluster by p.vec as sc
+cluster as members
+with { "dimension": [128], "num_clusters": 64, "seed": 42 }
+select (select value gi.p.id from members as gi order by gi.p.id) as ids,
+       array_count(members) as cnt
+order by ids;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/kmeans-seed/kmeans-seed.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/kmeans-seed/kmeans-seed.4.query.sqlpp
new file mode 100644
index 0000000000..bf3bb0e4ab
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/kmeans-seed/kmeans-seed.4.query.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+-- Seed 7 must not reproduce seed 42's result, or the seed is being accepted and ignored.
+use test;
+
+from Points as p
+cluster by p.vec as sc
+cluster as members
+with { "dimension": [128], "num_clusters": 64, "seed": 7 }
+select (select value gi.p.id from members as gi order by gi.p.id) as ids,
+       array_count(members) as cnt
+order by ids;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/kmeans-seed/kmeans-seed.5.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/kmeans-seed/kmeans-seed.5.query.sqlpp
new file mode 100644
index 0000000000..1426e3b8c8
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/kmeans-seed/kmeans-seed.5.query.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+-- A negative seed is legal: Random accepts the whole int range.
+use test;
+
+from Points as p
+cluster by p.vec as sc
+cluster as members
+with { "dimension": [128], "num_clusters": 64, "seed": -5 }
+select (select value gi.p.id from members as gi order by gi.p.id) as ids,
+       array_count(members) as cnt
+order by ids;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/negative/seed-not-integer/test.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/negative/seed-not-integer/test.1.query.sqlpp
new file mode 100644
index 0000000000..a925ad79a9
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/negative/seed-not-integer/test.1.query.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+-- A seed that is not an integer is rejected, not ignored.
+from [{"v": [1.0, 2.0]}, {"v": [3.0, 4.0]}] as p
+cluster by p.v as sc
+cluster as members
+with { "dimension": [2], "num_clusters": 2, "seed": "abc" }
+select value sc.cluster_id;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/negative/seed-out-of-int-range/test.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/negative/seed-out-of-int-range/test.1.query.sqlpp
new file mode 100644
index 0000000000..5513226b3c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/negative/seed-out-of-int-range/test.1.query.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+-- Past 2^31-1 is rejected rather than wrapped: truncating would map distinct seeds onto one.
+from [{"v": [1.0, 2.0]}, {"v": [3.0, 4.0]}] as p
+cluster by p.v as sc
+cluster as members
+with { "dimension": [2], "num_clusters": 2, "seed": 2147483648 }
+select value sc.cluster_id;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/negative/seed-with-unsupported-algorithm/test.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/negative/seed-with-unsupported-algorithm/test.1.query.sqlpp
new file mode 100644
index 0000000000..3960e108a2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/cluster-by/negative/seed-with-unsupported-algorithm/test.1.query.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+-- Both checks fire; the algorithm is the one reported, since it is what has to change.
+from [{"v": [1.0, 2.0]}, {"v": [3.0, 4.0]}] as p
+cluster by p.v as sc
+cluster as members
+with { "dimension": [2], "num_clusters": 2, "clustering_algorithm": "DBSCAN", "seed": 1 }
+select value sc.cluster_id;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-seed/kmeans-seed.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-seed/kmeans-seed.3.adm
new file mode 100644
index 0000000000..af5bbe5eda
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-seed/kmeans-seed.3.adm
@@ -0,0 +1,64 @@
+{ "ids": [ 1, 28, 55, 82, 109, 406, 487, 541, 595, 622, 649, 676, 730, 757, 784, 811, 838, 865, 892, 919, 946, 973, 1000, 1136, 1163, 1190, 1217, 1244, 1271, 1298, 1325, 1379, 1406, 1433, 1460, 1487, 1514, 1541, 1568, 1595, 1622, 1649, 1676, 1704, 1730, 1731, 1757, 1784, 1811, 1839, 1865, 1866, 1892, 1919, 1946, 1973, 1974 ], "cnt": 57 }
+{ "ids": [ 2, 110, 138, 191, 218, 246, 273, 299, 355, 408, 435, 489, 543, 570, 597, 623, 624, 678, 731, 732, 759, 786, 840, 894, 975, 1030, 1083, 1111, 1138, 1191, 1219, 1299, 1327, 1354, 1381, 1408, 1462, 1543, 1570, 1651, 1705, 1759, 1813, 1867, 1895, 1921 ], "cnt": 46 }
+{ "ids": [ 3, 30, 84, 112, 192, 193, 219, 274, 381, 463, 490, 544, 571, 652, 679, 733, 760, 787, 814, 841, 868, 923, 949, 1003, 1057, 1139, 1165, 1192, 1220, 1246, 1301, 1355, 1382, 1491, 1516, 1517, 1571, 1598, 1679, 1706, 1732, 1760, 1787, 1814, 1841, 1868, 1949, 1950, 1976 ], "cnt": 49 }
+{ "ids": [ 4, 139, 166, 301, 653, 707, 869, 976, 1409, 1490, 1544, 1977 ], "cnt": 12 }
+{ "ids": [ 5, 32, 59, 86, 140, 141, 248, 546, 573, 626, 680, 761, 788, 789, 816, 842, 897, 951, 1167, 1194, 1248, 1275, 1329, 1383, 1384, 1627, 1762, 1789, 1842, 1843, 1869, 1924, 1951, 1952 ], "cnt": 34 }
+{ "ids": [ 6, 60, 87, 114, 142, 168, 222, 384, 411, 465, 492, 519, 627, 681, 682, 710, 870, 898, 952, 978, 979, 1006, 1060, 1086, 1087, 1114, 1141, 1357, 1411, 1438, 1465, 1519, 1546, 1547, 1654, 1816, 1844, 1925, 1979 ], "cnt": 39 }
+{ "ids": [ 7, 115, 304, 332, 575, 602, 764, 791, 845, 872, 926, 953, 1034, 1115, 1142, 1170, 1332, 1385, 1440, 1548, 1602, 1656, 1683, 1710, 1764, 1791, 1846, 1872, 1953 ], "cnt": 29 }
+{ "ids": [ 8, 35, 170, 197, 198, 224, 251, 278, 305, 440, 467, 468, 494, 521, 522, 656, 737, 738, 765, 792, 819, 846, 1008, 1035, 1062, 1089, 1116, 1143, 1305, 1306, 1359, 1386, 1413, 1467, 1575, 1576, 1603, 1629, 1630, 1657, 1845, 1873, 1900, 1927, 1954, 1981 ], "cnt": 46 }
+{ "ids": [ 9, 36, 63, 117, 171, 225, 279, 333, 361, 387, 441, 495, 549, 603, 604, 631, 657, 712, 793, 820, 847, 874, 901, 955, 1009, 1063, 1117, 1199, 1225, 1279, 1333, 1387, 1441, 1469, 1495, 1496, 1549, 1577, 1604, 1658, 1793, 1847, 1901, 1955 ], "cnt": 44 }
+{ "ids": [ 10, 37, 64, 92, 118, 145, 172, 199, 226, 253, 280, 307, 334, 388, 415, 442, 469, 496, 497, 523, 550, 577, 658, 685, 713, 739, 766, 767, 848, 875, 929, 983, 1037, 1065, 1091, 1145, 1171, 1172, 1226, 1253, 1280, 1307, 1334, 1335, 1361, 1388, 1415, 1442, 1497, 1523, 1550, 1631, 1685, 1712, 1739, 1740, 1766, 1767, 1794, 1821, 1848, 1902, 1929, 1956, 1983 ], "cnt": 65 }
+{ "ids": [ 11, 38, 65, 119, 146, 173, 254, 308, 335, 416, 524, 578, 605, 660, 686, 740, 794, 902, 930, 956, 984, 1010, 1038, 1118, 1200, 1281, 1362, 1470, 1524, 1551, 1578, 1659, 1686, 1822, 1849, 1876, 1930 ], "cnt": 37 }
+{ "ids": [ 12, 147, 174, 336, 417, 498, 606, 687, 714, 715, 742, 796, 876, 1066, 1174, 1255, 1282, 1336, 1417, 1444, 1606, 1795, 1823 ], "cnt": 23 }
+{ "ids": [ 13, 121, 255, 310, 337, 364, 418, 525, 553, 634, 661, 823, 877, 904, 931, 1093, 1121, 1175, 1229, 1283, 1363, 1418, 1445, 1472, 1499, 1526, 1580, 1607, 1661, 1689, 1742, 1850, 1931, 1985 ], "cnt": 34 }
+{ "ids": [ 14, 95, 122, 203, 311, 474, 500, 501, 555, 663, 960, 1068, 1257, 1258, 1284, 1285, 1473, 1852, 1933 ], "cnt": 19 }
+{ "ids": [ 15, 43, 69, 177, 178, 232, 286, 367, 421, 448, 475, 502, 503, 529, 556, 583, 610, 637, 664, 691, 718, 772, 826, 880, 907, 934, 935, 961, 988, 989, 1042, 1043, 1178, 1232, 1259, 1286, 1340, 1367, 1421, 1475, 1502, 1529, 1583, 1610, 1637, 1664, 1691, 1746, 1772, 1800, 1826, 1989 ], "cnt": 52 }
+{ "ids": [ 16, 17, 70, 71, 97, 98, 124, 151, 205, 259, 260, 313, 314, 422, 476, 557, 611, 638, 639, 665, 692, 745, 773, 800, 854, 881, 962, 1016, 1070, 1097, 1124, 1151, 1179, 1205, 1206, 1260, 1313, 1341, 1368, 1394, 1448, 1530, 1556, 1584, 1665, 1692, 1719, 1773, 1827, 1881, 1908, 1909, 1962 ], "cnt": 53 }
+{ "ids": [ 18, 19, 46, 73, 100, 127, 154, 180, 181, 208, 235, 289, 316, 343, 370, 397, 424, 425, 451, 478, 505, 532, 533, 559, 560, 586, 613, 695, 722, 748, 749, 776, 803, 910, 992, 1046, 1073, 1100, 1127, 1128, 1154, 1181, 1208, 1235, 1262, 1263, 1289, 1316, 1342, 1343, 1369, 1397, 1424, 1451, 1478, 1559, 1586, 1613, 1694, 1776, 1803, 1830, 1856, 1857, 1883, 1884, 1910, 1937, 1938, 1965, 1992 ], "cnt": 71 }
+{ "ids": [ 20, 101, 155, 182, 262, 263, 317, 344, 398, 426, 452, 479, 588, 614, 641, 723, 830, 857, 884, 885, 911, 938, 965, 966, 1019, 1020, 1101, 1209, 1317, 1344, 1398, 1425, 1479, 1506, 1533, 1560, 1587, 1614, 1641, 1668, 1669, 1695, 1722, 1831, 1885, 1911, 1912, 1966 ], "cnt": 48 }
+{ "ids": [ 21, 48, 49, 102, 156, 184, 211, 237, 319, 346, 372, 454, 481, 562, 589, 616, 617, 670, 697, 724, 751, 752, 805, 832, 886, 887, 940, 1021, 1022, 1156, 1157, 1292, 1319, 1400, 1427, 1454, 1535, 1589, 1590, 1643, 1670, 1724, 1725, 1778, 1805, 1859, 1860, 1913, 1940, 1995 ], "cnt": 50 }
+{ "ids": [ 22, 76, 103, 130, 157, 238, 265, 292, 400, 427, 535, 644, 671, 698, 725, 779, 806, 833, 860, 914, 941, 968, 995, 1049, 1076, 1103, 1130, 1184, 1211, 1238, 1265, 1346, 1373, 1455, 1481, 1508, 1644, 1671, 1698, 1752, 1779, 1806, 1833, 1887, 1914, 1941, 1968 ], "cnt": 47 }
+{ "ids": [ 23, 50, 131, 240, 320, 348, 375, 483, 537, 618, 699, 834, 969, 1131, 1185, 1240, 1347, 1537, 1672, 1699, 1753, 1834, 1915, 1969 ], "cnt": 24 }
+{ "ids": [ 24, 25, 51, 132, 159, 160, 186, 187, 267, 295, 321, 322, 402, 430, 457, 484, 565, 592, 619, 700, 727, 754, 755, 780, 862, 889, 890, 915, 1025, 1052, 1159, 1187, 1213, 1322, 1348, 1457, 1483, 1592, 1727, 1754, 1781, 1862, 1889, 1916, 1917 ], "cnt": 45 }
+{ "ids": [ 26, 53, 162, 324, 459, 486, 513, 621, 648, 783, 810, 999, 1026, 1081, 1161, 1269, 1540, 1594, 1702, 1729, 1756, 1783, 1891 ], "cnt": 23 }
+{ "ids": [ 27, 81, 134, 135, 189, 216, 243, 270, 351, 378, 405, 540, 567, 568, 594, 702, 703, 729, 891, 1027, 1053, 1054, 1135, 1162, 1189, 1216, 1242, 1270, 1297, 1324, 1351, 1378, 1459, 1486, 1513, 1621, 1648, 1675, 1703, 1810, 1837, 1838, 1972, 1999 ], "cnt": 44 }
+{ "ids": [ 29, 56, 164, 190, 325, 353, 380, 407, 433, 461, 515, 542, 596, 758, 813, 866, 893, 948, 974, 1001, 1002, 1029, 1137, 1218, 1326, 1352, 1353, 1380, 1407, 1434, 1461, 1515, 1569, 1758, 1785, 1812, 1893, 1894, 1920, 1947, 1948, 1975 ], "cnt": 42 }
+{ "ids": [ 31, 302, 329, 356, 409, 410, 437, 464, 491, 950, 977, 1031, 1193, 1274, 1518, 1545, 1572, 1599, 1625, 1626, 1680, 1707, 1734, 1761, 1788 ], "cnt": 25 }
+{ "ids": [ 33, 61, 358, 547, 818, 1331, 1628, 1655, 1871, 1899 ], "cnt": 10 }
+{ "ids": [ 34, 249, 277, 331, 493, 520, 548, 601, 629, 817, 844, 871, 899, 1061, 1088, 1169, 1278, 1358, 1412, 1466, 1709, 1737, 1790, 1818, 1926, 1980 ], "cnt": 26 }
+{ "ids": [ 39, 66, 93, 120, 201, 227, 228, 282, 309, 363, 444, 445, 471, 526, 552, 579, 607, 741, 769, 795, 822, 958, 985, 1011, 1012, 1039, 1120, 1147, 1201, 1228, 1309, 1390, 1471, 1498, 1525, 1552, 1553, 1579, 1634, 1715, 1768, 1877, 1904 ], "cnt": 43 }
+{ "ids": [ 40, 67, 94, 148, 175, 257, 284, 391, 472, 499, 580, 635, 662, 689, 716, 743, 1013, 1040, 1067, 1094, 1148, 1202, 1311, 1716, 1743, 1770, 1796, 1797 ], "cnt": 28 }
+{ "ids": [ 41, 68, 176, 230, 365, 419, 447, 473, 581, 690, 717, 744, 771, 825, 986, 987, 1041, 1095, 1122, 1149, 1203, 1230, 1338, 1392, 1420, 1500, 1554, 1608, 1636, 1690, 1717, 1744, 1771, 1906, 1959, 1960, 1988 ], "cnt": 37 }
+{ "ids": [ 42, 150, 204, 231, 258, 285, 340, 528, 799, 853, 879, 1231, 1447, 1474, 1528, 1555, 1582, 1799 ], "cnt": 18 }
+{ "ids": [ 44, 99, 125, 152, 179, 233, 287, 341, 368, 395, 449, 504, 530, 584, 693, 719, 746, 801, 827, 855, 908, 936, 990, 1017, 1044, 1098, 1125, 1152, 1207, 1233, 1287, 1314, 1395, 1422, 1449, 1476, 1503, 1504, 1557, 1611, 1638, 1666, 1775, 1801, 1828, 1854, 1855, 1935, 1963, 1990 ], "cnt": 50 }
+{ "ids": [ 45, 153, 207, 261, 288, 396, 423, 612, 640, 694, 721, 774, 775, 802, 828, 829, 856, 883, 964, 991, 1018, 1099, 1126, 1180, 1234, 1261, 1370, 1396, 1477, 1505, 1532, 1585, 1612, 1640, 1667, 1721, 1747, 1748, 1802, 1829, 1964 ], "cnt": 41 }
+{ "ids": [ 47, 74, 128, 209, 290, 371, 506, 587, 668, 750, 777, 831, 858, 912, 939, 994, 1074, 1155, 1236, 1290, 1371, 1452, 1480, 1534, 1642, 1749, 1777, 1858, 1939 ], "cnt": 29 }
+{ "ids": [ 52, 106, 107, 133, 215, 241, 242, 268, 296, 350, 376, 377, 458, 485, 511, 512, 593, 646, 647, 701, 728, 782, 836, 863, 917, 918, 945, 998, 1080, 1133, 1214, 1215, 1241, 1268, 1323, 1350, 1431, 1458, 1485, 1566, 1593, 1620, 1701, 1755, 1809, 1836, 1863, 1890 ], "cnt": 48 }
+{ "ids": [ 54, 108, 297, 432, 1108, 1243, 1432, 1567, 2000 ], "cnt": 9 }
+{ "ids": [ 57, 58, 85, 220, 247, 328, 382, 383, 436, 598, 625, 706, 815, 1004, 1058, 1084, 1112, 1166, 1221, 1328, 1436, 1463, 1652, 1733, 1896, 1922 ], "cnt": 26 }
+{ "ids": [ 62, 89, 116, 143, 359, 386, 413, 683, 684, 711, 927, 954, 981, 1197, 1224, 1251, 1494, 1521, 1792, 1819 ], "cnt": 20 }
+{ "ids": [ 72, 126, 206, 234, 315, 342, 369, 450, 477, 531, 558, 585, 666, 667, 720, 747, 882, 909, 937, 963, 1045, 1071, 1072, 1153, 1288, 1315, 1423, 1450, 1531, 1558, 1639, 1693, 1720, 1774, 1882, 1936, 1991 ], "cnt": 37 }
+{ "ids": [ 75, 236, 399, 480, 507, 534, 615, 642, 804, 967, 1047, 1075, 1102, 1182, 1183, 1210, 1318, 1507, 1562, 1615, 1723, 1750, 1993 ], "cnt": 23 }
+{ "ids": [ 77, 104, 158, 185, 212, 213, 239, 266, 293, 347, 374, 401, 428, 455, 482, 509, 510, 536, 563, 590, 645, 672, 807, 942, 996, 1104, 1158, 1212, 1239, 1266, 1293, 1320, 1374, 1401, 1428, 1482, 1509, 1536, 1563, 1617, 1861, 1888, 1996 ], "cnt": 43 }
+{ "ids": [ 78, 79, 214, 349, 403, 538, 673, 808, 835, 943, 970, 971, 1078, 1105, 1106, 1160, 1295, 1375, 1376, 1403, 1430, 1511, 1538, 1565, 1646, 1673, 1700, 1808, 1835, 1943, 1944, 1970, 1971, 1998 ], "cnt": 34 }
+{ "ids": [ 80, 161, 188, 269, 323, 404, 431, 539, 566, 620, 674, 675, 756, 809, 837, 864, 944, 972, 1079, 1107, 1134, 1188, 1296, 1377, 1404, 1405, 1512, 1539, 1647, 1674, 1728, 1782, 1864, 1918, 1945 ], "cnt": 35 }
+{ "ids": [ 83, 111, 137, 165, 300, 327, 354, 462, 516, 651, 705, 867, 895, 921, 922, 1056, 1110, 1164, 1273, 1300, 1435, 1489, 1597, 1624, 1678, 1786, 1840 ], "cnt": 27 }
+{ "ids": [ 88, 223, 276, 385, 412, 439, 628, 736, 1007, 1033, 1249, 1250, 1304, 1601, 1817, 1898 ], "cnt": 16 }
+{ "ids": [ 90, 144, 252, 306, 360, 414, 576, 630, 873, 900, 928, 982, 1036, 1090, 1144, 1198, 1252, 1360, 1414, 1468, 1522, 1684, 1711, 1738, 1765, 1820, 1874, 1928, 1982 ], "cnt": 29 }
+{ "ids": [ 91, 200, 281, 362, 389, 390, 443, 470, 551, 632, 633, 659, 768, 821, 849, 903, 957, 1064, 1092, 1119, 1146, 1173, 1227, 1254, 1308, 1389, 1416, 1443, 1605, 1632, 1633, 1660, 1687, 1713, 1714, 1741, 1875, 1903, 1957, 1984 ], "cnt": 40 }
+{ "ids": [ 96, 123, 339, 582, 609, 933, 1150, 1177, 1501, 1609, 1825, 1853 ], "cnt": 12 }
+{ "ids": [ 105, 294, 429, 456, 564, 591, 726, 753, 781, 861, 888, 916, 997, 1023, 1024, 1050, 1051, 1077, 1132, 1186, 1267, 1294, 1321, 1349, 1402, 1429, 1456, 1484, 1510, 1564, 1591, 1618, 1619, 1645, 1726, 1780, 1807, 1942, 1997 ], "cnt": 39 }
+{ "ids": [ 113, 167, 194, 275, 357, 438, 518, 599, 654, 735, 762, 843, 924, 1032, 1059, 1113, 1303, 1356, 1410, 1437, 1492, 1600, 1681, 1708, 1870, 1897, 1978 ], "cnt": 27 }
+{ "ids": [ 129, 210, 264, 345, 373, 508, 643, 669, 778, 913, 1048, 1237, 1372, 1453, 1588, 1616, 1697, 1751, 1832, 1967 ], "cnt": 20 }
+{ "ids": [ 136, 163, 217, 244, 271, 298, 326, 352, 379, 434, 460, 514, 569, 677, 704, 785, 812, 839, 920, 947, 1028, 1055, 1245, 1488, 1596, 1623 ], "cnt": 26 }
+{ "ids": [ 149, 202, 229, 256, 283, 392, 446, 527, 554, 608, 688, 770, 797, 824, 851, 852, 878, 905, 932, 959, 1014, 1176, 1256, 1310, 1337, 1364, 1365, 1391, 1419, 1446, 1527, 1581, 1635, 1662, 1824, 1851, 1878, 1905, 1932, 1986, 1987 ], "cnt": 41 }
+{ "ids": [ 169, 250, 466, 709, 790, 980, 1196, 1277, 1439, 1520, 1682 ], "cnt": 11 }
+{ "ids": [ 183, 291, 859, 1291, 1426, 1886, 1994 ], "cnt": 7 }
+{ "ids": [ 195, 303, 330, 600, 708, 763, 1005, 1168, 1195, 1222, 1276, 1330, 1573, 1735, 1736, 1763 ], "cnt": 16 }
+{ "ids": [ 196, 574, 655, 925, 1223, 1493, 1574 ], "cnt": 7 }
+{ "ids": [ 221, 517, 545, 572, 734, 896, 1085, 1140, 1247, 1302, 1464, 1653, 1815, 1923 ], "cnt": 14 }
+{ "ids": [ 245, 272, 488, 650, 1082, 1109, 1272, 1542, 1650, 1677 ], "cnt": 10 }
+{ "ids": [ 312, 366, 393, 394, 420, 636, 798, 1015, 1069, 1096, 1123, 1204, 1312, 1339, 1366, 1393, 1663, 1718, 1745, 1798, 1880, 1907, 1934, 1961 ], "cnt": 24 }
+{ "ids": [ 318, 453, 561, 696, 993, 1129, 1264, 1345, 1399, 1561, 1696, 1804 ], "cnt": 12 }
+{ "ids": [ 338, 906, 1879 ], "cnt": 3 }
+{ "ids": [ 850, 1688, 1769, 1958 ], "cnt": 4 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-seed/kmeans-seed.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-seed/kmeans-seed.4.adm
new file mode 100644
index 0000000000..b514210ed3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-seed/kmeans-seed.4.adm
@@ -0,0 +1,64 @@
+{ "ids": [ 1, 28, 56, 109, 136, 245, 271, 298, 433, 434, 461, 569, 595, 622, 704, 730, 839, 866, 893, 920, 1028, 1055, 1163, 1190, 1217, 1298, 1352, 1434, 1461, 1487, 1488, 1622, 1731, 1758, 1784, 1811, 1812, 1866, 1893, 1920, 1947 ], "cnt": 41 }
+{ "ids": [ 2, 29, 83, 137, 163, 164, 218, 272, 299, 326, 353, 380, 407, 488, 489, 515, 542, 596, 623, 650, 677, 705, 731, 732, 758, 786, 813, 867, 894, 974, 975, 1001, 1002, 1029, 1056, 1109, 1110, 1137, 1191, 1218, 1245, 1272, 1299, 1326, 1353, 1380, 1407, 1462, 1515, 1542, 1569, 1596, 1623, 1650, 1677, 1678, 1759, 1785, 1786, 1867, 1948 ], "cnt": 61 }
+{ "ids": [ 3, 30, 57, 110, 111, 165, 191, 219, 246, 273, 300, 327, 354, 355, 381, 408, 435, 462, 490, 516, 543, 570, 597, 624, 651, 678, 759, 787, 840, 841, 868, 895, 921, 922, 923, 948, 976, 1003, 1030, 1057, 1083, 1111, 1138, 1164, 1165, 1219, 1273, 1327, 1354, 1381, 1408, 1435, 1489, 1516, 1543, 1570, 1597, 1598, 1624, 1651, 1705, 1706, 1732, 1787, 1813, 1840, 1894, 1895, 1921, 1949, 1975, 1976 ], "cnt": 72 }
+{ "ids": [ 4, 463, 517, 571, 572, 598, 625, 679, 896, 1031, 1085, 1139, 1247, 1355, 1409, 1463, 1464, 1571, 1626, 1653, 1815, 1922, 1977 ], "cnt": 23 }
+{ "ids": [ 5, 32, 59, 86, 167, 194, 302, 329, 356, 410, 464, 546, 626, 680, 734, 788, 897, 950, 951, 977, 1193, 1194, 1248, 1302, 1410, 1518, 1545, 1572, 1599, 1680, 1707, 1734, 1761, 1788, 1789, 1842, 1923 ], "cnt": 37 }
+{ "ids": [ 6, 33, 60, 87, 113, 114, 140, 141, 142, 168, 195, 221, 248, 275, 303, 330, 357, 384, 411, 438, 465, 492, 518, 519, 573, 600, 627, 654, 681, 708, 735, 762, 763, 789, 816, 843, 870, 924, 925, 952, 978, 979, 1005, 1032, 1059, 1060, 1086, 1113, 1114, 1140, 1141, 1167, 1168, 1195, 1222, 1276, 1303, 1330, 1356, 1357, 1384, 1411, 1438, 1465, 1492, 1519, 1546, 1547, 1573, 1600, 1627, 1681, 1708, 1735, 1762, 1816, 1843, 1870, 1871, 1897, 1924, 1925, 1951, 1952, 1978, 1979 ], "cnt": 86 }
+{ "ids": [ 7, 34, 88, 115, 223, 304, 332, 413, 547, 575, 601, 602, 683, 764, 791, 845, 872, 926, 953, 1034, 1061, 1115, 1142, 1170, 1251, 1278, 1332, 1358, 1385, 1440, 1521, 1548, 1602, 1629, 1682, 1683, 1710, 1791, 1818, 1846, 1872, 1899, 1953 ], "cnt": 43 }
+{ "ids": [ 8, 35, 89, 116, 170, 197, 198, 224, 251, 278, 359, 386, 440, 467, 468, 494, 521, 522, 656, 737, 738, 792, 819, 873, 927, 954, 1008, 1035, 1036, 1062, 1089, 1116, 1143, 1197, 1224, 1305, 1306, 1359, 1386, 1413, 1575, 1576, 1657, 1792, 1845, 1873, 1900, 1927, 1954, 1981 ], "cnt": 50 }
+{ "ids": [ 9, 63, 171, 253, 333, 495, 577, 603, 604, 631, 658, 685, 820, 847, 901, 1009, 1063, 1172, 1199, 1333, 1469, 1496, 1577, 1604, 1847, 1901 ], "cnt": 26 }
+{ "ids": [ 10, 37, 118, 145, 199, 226, 280, 307, 334, 388, 415, 442, 469, 496, 497, 523, 550, 739, 767, 875, 929, 983, 1091, 1145, 1171, 1253, 1280, 1307, 1361, 1388, 1415, 1442, 1497, 1523, 1550, 1631, 1658, 1685, 1712, 1739, 1740, 1766, 1767, 1821, 1848, 1929, 1956, 1983 ], "cnt": 48 }
+{ "ids": [ 11, 64, 91, 92, 172, 173, 200, 308, 362, 389, 390, 416, 443, 470, 551, 578, 605, 632, 659, 686, 713, 740, 766, 821, 848, 902, 956, 957, 1010, 1037, 1038, 1064, 1065, 1118, 1119, 1226, 1227, 1254, 1308, 1334, 1335, 1416, 1443, 1524, 1578, 1605, 1632, 1633, 1659, 1686, 1713, 1794, 1822, 1875, 1902, 1903 ], "cnt": 56 }
+{ "ids": [ 12, 147, 174, 256, 336, 337, 363, 445, 499, 526, 688, 715, 742, 796, 877, 904, 931, 985, 1039, 1066, 1255, 1283, 1336, 1364, 1417, 1445, 1553, 1607, 1634, 1742, 1769, 1795, 1796, 1823, 1850, 1904, 1985 ], "cnt": 37 }
+{ "ids": [ 13, 39, 66, 121, 255, 282, 310, 364, 418, 444, 525, 553, 607, 661, 769, 823, 850, 1012, 1093, 1121, 1229, 1363, 1418, 1472, 1526, 1580, 1661, 1689, 1715, 1877, 1931, 1958 ], "cnt": 32 }
+{ "ids": [ 14, 42, 96, 123, 231, 285, 312, 339, 366, 474, 501, 528, 555, 582, 609, 636, 663, 799, 879, 960, 1042, 1177, 1231, 1258, 1284, 1285, 1393, 1447, 1474, 1501, 1528, 1609, 1745, 1799, 1825, 1852, 1853, 1933, 1961 ], "cnt": 39 }
+{ "ids": [ 15, 43, 124, 177, 178, 204, 259, 340, 394, 475, 503, 556, 583, 610, 691, 718, 772, 880, 907, 934, 962, 1043, 1069, 1070, 1151, 1178, 1259, 1421, 1475, 1502, 1610, 1637, 1746, 1934, 1989 ], "cnt": 35 }
+{ "ids": [ 16, 179, 367, 395, 719, 746, 935, 1286, 1422, 1503, 1638, 1800, 1854 ], "cnt": 13 }
+{ "ids": [ 17, 70, 71, 97, 151, 152, 205, 233, 260, 313, 314, 341, 422, 476, 557, 611, 638, 639, 692, 745, 773, 801, 854, 881, 1016, 1097, 1124, 1179, 1205, 1206, 1260, 1313, 1341, 1368, 1394, 1448, 1449, 1530, 1584, 1611, 1665, 1692, 1719, 1827, 1828, 1881, 1908, 1909, 1962, 1990 ], "cnt": 50 }
+{ "ids": [ 18, 45, 154, 180, 235, 289, 342, 586, 613, 721, 748, 883, 1045, 1235, 1289, 1342, 1424, 1451, 1586, 1721, 1883, 1938 ], "cnt": 22 }
+{ "ids": [ 19, 73, 127, 208, 398, 451, 452, 479, 506, 533, 587, 641, 668, 695, 722, 776, 1073, 1100, 1154, 1155, 1208, 1209, 1263, 1290, 1343, 1344, 1371, 1397, 1776, 1803, 1831, 1857, 1911, 1965, 1992 ], "cnt": 35 }
+{ "ids": [ 20, 155, 182, 209, 262, 263, 316, 317, 344, 426, 588, 723, 830, 857, 884, 911, 938, 965, 966, 1019, 1020, 1101, 1398, 1425, 1479, 1506, 1533, 1560, 1587, 1614, 1641, 1668, 1669, 1695, 1722, 1966 ], "cnt": 36 }
+{ "ids": [ 21, 49, 129, 156, 184, 211, 264, 291, 319, 346, 373, 454, 481, 508, 589, 616, 617, 643, 724, 751, 752, 778, 859, 886, 887, 913, 1021, 1022, 1156, 1157, 1211, 1292, 1319, 1346, 1427, 1454, 1481, 1589, 1590, 1616, 1643, 1724, 1725, 1751, 1778, 1859, 1860, 1886, 1913, 1940, 1994, 1995 ], "cnt": 52 }
+{ "ids": [ 22, 76, 400, 509, 535, 644, 671, 725, 779, 860, 914, 968, 1049, 1103, 1184, 1238, 1293, 1373, 1428, 1671, 1698, 1752, 1806, 1887, 1941 ], "cnt": 25 }
+{ "ids": [ 23, 77, 131, 158, 185, 212, 293, 294, 320, 347, 374, 375, 429, 455, 590, 591, 645, 726, 781, 861, 888, 942, 996, 1023, 1077, 1158, 1185, 1212, 1239, 1294, 1374, 1429, 1509, 1510, 1536, 1564, 1591, 1645, 1726, 1780, 1807, 1888, 1942 ], "cnt": 43 }
+{ "ids": [ 24, 78, 79, 159, 214, 403, 538, 592, 673, 727, 808, 862, 943, 971, 997, 1078, 1106, 1160, 1213, 1295, 1376, 1430, 1511, 1538, 1565, 1646, 1673, 1808, 1862, 1943, 1944, 1971, 1997 ], "cnt": 33 }
+{ "ids": [ 25, 51, 132, 160, 186, 187, 267, 295, 321, 322, 349, 402, 430, 457, 484, 565, 619, 700, 754, 780, 835, 889, 890, 915, 970, 1024, 1025, 1159, 1267, 1348, 1402, 1403, 1457, 1483, 1592, 1700, 1727, 1754, 1781, 1835, 1889, 1916, 1917, 1970 ], "cnt": 44 }
+{ "ids": [ 26, 80, 162, 188, 242, 269, 323, 324, 377, 431, 459, 513, 566, 620, 621, 648, 675, 809, 810, 837, 864, 945, 999, 1081, 1107, 1134, 1188, 1296, 1377, 1405, 1432, 1485, 1539, 1540, 1567, 1674, 1702, 1728, 1729, 1756, 1783, 1864, 1918, 1945 ], "cnt": 44 }
+{ "ids": [ 27, 54, 81, 108, 134, 135, 189, 216, 243, 270, 351, 378, 405, 540, 567, 568, 594, 702, 729, 756, 891, 1027, 1053, 1054, 1135, 1162, 1189, 1216, 1242, 1270, 1297, 1324, 1351, 1378, 1459, 1486, 1513, 1621, 1675, 1810, 1837, 1838, 1972, 1999 ], "cnt": 44 }
+{ "ids": [ 31, 437, 491, 545, 599, 707, 761, 869, 1275, 1329, 1383, 1437 ], "cnt": 12 }
+{ "ids": [ 36, 117, 225, 279, 361, 387, 441, 549, 657, 712, 793, 874, 955, 1117, 1225, 1279, 1387, 1441, 1495, 1549, 1793, 1955 ], "cnt": 22 }
+{ "ids": [ 38, 65, 119, 120, 227, 228, 254, 281, 335, 498, 524, 552, 606, 660, 768, 794, 822, 930, 958, 984, 1092, 1120, 1146, 1173, 1174, 1200, 1228, 1281, 1362, 1389, 1390, 1470, 1498, 1551, 1552, 1660, 1687, 1714, 1741, 1768, 1849, 1930, 1957, 1984 ], "cnt": 44 }
+{ "ids": [ 40, 94, 95, 148, 149, 175, 202, 229, 283, 284, 311, 391, 392, 446, 472, 500, 554, 580, 608, 634, 689, 716, 743, 770, 797, 851, 852, 878, 905, 932, 959, 1013, 1014, 1067, 1068, 1094, 1148, 1175, 1176, 1202, 1256, 1257, 1310, 1337, 1365, 1391, 1419, 1473, 1499, 1527, 1581, 1635, 1662, 1688, 1743, 1770, 1797, 1824, 1851, 1878, 1932, 1986, 1987 ], "cnt": 63 }
+{ "ids": [ 41, 68, 122, 176, 203, 257, 338, 419, 447, 581, 662, 690, 717, 744, 771, 798, 824, 825, 906, 986, 987, 1015, 1041, 1122, 1149, 1203, 1230, 1311, 1392, 1420, 1554, 1636, 1690, 1716, 1717, 1771, 1879, 1959, 1960, 1988 ], "cnt": 40 }
+{ "ids": [ 44, 99, 368, 450, 504, 530, 584, 855, 882, 908, 936, 990, 1071, 1072, 1098, 1207, 1233, 1287, 1395, 1476, 1504, 1639, 1666, 1775, 1855, 1963 ], "cnt": 26 }
+{ "ids": [ 46, 100, 181, 343, 397, 424, 425, 478, 559, 560, 614, 749, 803, 910, 992, 1046, 1127, 1128, 1181, 1262, 1316, 1317, 1478, 1559, 1613, 1749, 1830, 1884, 1910 ], "cnt": 29 }
+{ "ids": [ 47, 74, 128, 236, 290, 371, 642, 750, 777, 831, 858, 912, 939, 994, 1074, 1075, 1210, 1236, 1452, 1480, 1534, 1615, 1642, 1723, 1804, 1858, 1993 ], "cnt": 27 }
+{ "ids": [ 48, 102, 183, 237, 318, 372, 453, 561, 670, 696, 805, 940, 993, 1129, 1264, 1345, 1399, 1561, 1562, 1696, 1939, 1967 ], "cnt": 22 }
+{ "ids": [ 50, 105, 240, 348, 456, 483, 537, 564, 618, 699, 753, 916, 1050, 1051, 1105, 1131, 1132, 1186, 1240, 1321, 1349, 1375, 1456, 1484, 1537, 1618, 1619, 1672, 1699, 1753, 1834, 1915, 1969 ], "cnt": 33 }
+{ "ids": [ 52, 107, 133, 268, 296, 376, 458, 511, 512, 593, 646, 647, 701, 728, 755, 782, 836, 863, 917, 998, 1052, 1080, 1133, 1187, 1215, 1241, 1268, 1322, 1350, 1431, 1566, 1620, 1701, 1755, 1809, 1836, 1863, 1890, 1998 ], "cnt": 39 }
+{ "ids": [ 53, 106, 215, 241, 350, 404, 486, 539, 674, 783, 944, 972, 1026, 1079, 1161, 1214, 1512, 1594, 1647, 1782 ], "cnt": 20 }
+{ "ids": [ 55, 82, 190, 217, 244, 297, 352, 379, 406, 432, 487, 541, 676, 784, 785, 811, 812, 865, 919, 947, 1000, 1082, 1108, 1243, 1244, 1379, 1406, 1433, 1541, 1568, 1595, 1676, 1704, 1730, 1839, 1865, 1919, 1974, 2000 ], "cnt": 39 }
+{ "ids": [ 58, 85, 139, 166, 220, 247, 301, 328, 382, 383, 409, 436, 706, 815, 1004, 1058, 1112, 1166, 1221, 1274, 1301, 1328, 1436, 1544, 1625, 1652, 1733, 1896 ], "cnt": 28 }
+{ "ids": [ 61, 305, 548, 629, 818, 899, 1088, 1169, 1467, 1494, 1656, 1737, 1764, 1926 ], "cnt": 14 }
+{ "ids": [ 62, 143, 144, 306, 360, 576, 630, 711, 900, 981, 1144, 1198, 1360, 1468, 1630, 1711, 1738, 1819, 1874 ], "cnt": 19 }
+{ "ids": [ 67, 230, 365, 473, 527, 635, 933, 1040, 1095, 1338, 1446, 1500, 1608, 1663, 1744, 1905, 1906 ], "cnt": 17 }
+{ "ids": [ 69, 393, 420, 988, 1150, 1204, 1312, 1339, 1366, 1718, 1798 ], "cnt": 11 }
+{ "ids": [ 72, 126, 153, 206, 207, 234, 423, 477, 531, 558, 585, 612, 667, 694, 802, 828, 909, 937, 963, 1099, 1126, 1153, 1180, 1450, 1505, 1531, 1558, 1585, 1640, 1747, 1748, 1774, 1882, 1936 ], "cnt": 34 }
+{ "ids": [ 75, 101, 210, 345, 399, 480, 507, 534, 615, 669, 804, 885, 967, 1047, 1048, 1102, 1182, 1183, 1237, 1291, 1318, 1372, 1426, 1453, 1507, 1588, 1750, 1777, 1885, 1912 ], "cnt": 30 }
+{ "ids": [ 84, 138, 192, 544, 652, 733, 760, 814, 949, 1084, 1192, 1220, 1246, 1300, 1382, 1491, 1679, 1760, 1814, 1841, 1868 ], "cnt": 21 }
+{ "ids": [ 90, 252, 414, 684, 928, 982, 1090, 1252, 1414, 1522, 1684, 1765, 1820, 1928, 1982 ], "cnt": 15 }
+{ "ids": [ 93, 201, 309, 471, 579, 633, 741, 795, 849, 903, 1011, 1147, 1201, 1309, 1471, 1525, 1579 ], "cnt": 17 }
+{ "ids": [ 98 ], "cnt": 1 }
+{ "ids": [ 103, 130, 157, 238, 265, 292, 427, 428, 562, 563, 697, 698, 806, 832, 833, 941, 995, 1076, 1130, 1265, 1400, 1455, 1508, 1535, 1644, 1670, 1697, 1779, 1805, 1832, 1833, 1914, 1968 ], "cnt": 33 }
+{ "ids": [ 104, 213, 239, 266, 401, 482, 510, 536, 672, 807, 834, 969, 1104, 1266, 1320, 1347, 1401, 1482, 1563, 1617, 1861, 1996 ], "cnt": 22 }
+{ "ids": [ 112, 193, 274, 653, 842, 1490, 1517, 1869, 1950 ], "cnt": 9 }
+{ "ids": [ 125, 315, 369, 693, 720, 747, 1044, 1125, 1152, 1288, 1314, 1396, 1423, 1612, 1693, 1720, 1801 ], "cnt": 17 }
+{ "ids": [ 146, 417, 687, 714, 876, 1282, 1444, 1606, 1876 ], "cnt": 9 }
+{ "ids": [ 150, 232, 258, 286, 448, 502, 664, 826, 853, 961, 1123, 1367, 1529, 1555, 1582, 1583, 1691, 1907 ], "cnt": 18 }
+{ "ids": [ 161, 485, 918, 1269, 1323, 1404, 1458, 1593, 1648, 1891 ], "cnt": 10 }
+{ "ids": [ 169, 196, 222, 249, 250, 276, 277, 331, 358, 385, 412, 439, 466, 493, 520, 574, 628, 655, 682, 709, 710, 736, 790, 817, 844, 871, 898, 980, 1006, 1007, 1033, 1087, 1196, 1223, 1249, 1250, 1277, 1304, 1331, 1412, 1439, 1466, 1493, 1520, 1574, 1601, 1628, 1654, 1655, 1709, 1736, 1763, 1790, 1817, 1844, 1898, 1980 ], "cnt": 57 }
+{ "ids": [ 261, 288, 370, 396, 505, 532, 640, 666, 774, 775, 829, 856, 964, 991, 1018, 1234, 1261, 1315, 1369, 1370, 1477, 1532, 1667, 1694, 1802, 1829, 1856, 1937, 1964, 1991 ], "cnt": 30 }
+{ "ids": [ 287, 449, 665, 800, 827, 989, 1017, 1557, 1773, 1935 ], "cnt": 10 }
+{ "ids": [ 325, 460, 514, 649, 703, 757, 838, 892, 946, 973, 1136, 1271, 1325, 1460, 1514, 1649, 1703, 1757, 1892, 1946, 1973 ], "cnt": 21 }
+{ "ids": [ 421, 529, 637, 1096, 1232, 1340, 1556, 1664, 1772, 1826, 1880 ], "cnt": 11 }
+{ "ids": [ 765, 846, 1603 ], "cnt": 3 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-seed/kmeans-seed.5.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-seed/kmeans-seed.5.adm
new file mode 100644
index 0000000000..d751d3da92
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-seed/kmeans-seed.5.adm
@@ -0,0 +1,64 @@
+{ "ids": [ 1, 190, 1163, 1190, 1352, 1487, 1568, 1731, 1758, 1785, 1920, 1947 ], "cnt": 12 }
+{ "ids": [ 2, 83, 110, 137, 164, 218, 299, 326, 327, 353, 407, 489, 543, 596, 623, 651, 678, 705, 731, 732, 786, 840, 867, 894, 975, 1056, 1083, 1110, 1111, 1191, 1218, 1272, 1299, 1380, 1462, 1569, 1596, 1597, 1624, 1651, 1678, 1705, 1759, 1786, 1813, 1840, 1867, 1948 ], "cnt": 48 }
+{ "ids": [ 3, 30, 57, 111, 165, 191, 219, 246, 273, 300, 354, 355, 381, 408, 435, 462, 490, 516, 570, 597, 624, 759, 787, 841, 868, 895, 921, 922, 923, 976, 1003, 1030, 1057, 1138, 1164, 1165, 1219, 1273, 1327, 1354, 1381, 1408, 1435, 1489, 1516, 1543, 1570, 1598, 1706, 1732, 1787, 1895, 1921, 1949, 1976 ], "cnt": 55 }
+{ "ids": [ 4, 58, 139, 383, 436, 517, 598, 625, 1085, 1247, 1409, 1463, 1625, 1626, 1653, 1815, 1922, 1977 ], "cnt": 18 }
+{ "ids": [ 5, 32, 59, 60, 465, 573, 870, 897, 1194, 1275, 1438, 1465, 1762 ], "cnt": 13 }
+{ "ids": [ 6, 114, 142, 168, 195, 303, 330, 357, 384, 411, 519, 600, 627, 681, 735, 763, 924, 925, 952, 978, 979, 1005, 1032, 1060, 1086, 1114, 1141, 1168, 1195, 1303, 1330, 1357, 1411, 1492, 1519, 1546, 1547, 1573, 1600, 1708, 1735, 1736, 1763, 1816, 1925, 1979 ], "cnt": 46 }
+{ "ids": [ 7, 34, 115, 304, 413, 575, 602, 683, 764, 791, 845, 872, 1034, 1142, 1251, 1332, 1385, 1440, 1494, 1521, 1602, 1683, 1710, 1764, 1791, 1846, 1872, 1953 ], "cnt": 28 }
+{ "ids": [ 8, 35, 170, 197, 198, 224, 278, 440, 467, 468, 494, 521, 656, 737, 738, 765, 846, 1008, 1035, 1062, 1116, 1143, 1305, 1306, 1386, 1413, 1575, 1576, 1603, 1845, 1873, 1900, 1954, 1981 ], "cnt": 34 }
+{ "ids": [ 9, 63, 90, 117, 171, 253, 333, 360, 361, 414, 495, 603, 604, 631, 658, 712, 739, 820, 847, 901, 928, 955, 1009, 1063, 1090, 1172, 1199, 1252, 1279, 1333, 1387, 1441, 1469, 1496, 1577, 1604, 1658, 1685, 1793, 1847, 1901, 1955, 1982 ], "cnt": 43 }
+{ "ids": [ 10, 38, 64, 91, 92, 146, 173, 200, 281, 362, 389, 390, 443, 470, 551, 578, 632, 659, 686, 713, 740, 766, 821, 849, 902, 957, 1037, 1064, 1065, 1119, 1173, 1227, 1254, 1308, 1334, 1335, 1389, 1416, 1443, 1524, 1578, 1605, 1632, 1633, 1686, 1687, 1713, 1741, 1794, 1875, 1902, 1903, 1984 ], "cnt": 53 }
+{ "ids": [ 11, 39, 65, 119, 201, 227, 228, 254, 282, 335, 471, 524, 552, 579, 660, 741, 768, 769, 822, 930, 958, 984, 1011, 1038, 1092, 1120, 1200, 1281, 1309, 1362, 1390, 1470, 1498, 1552, 1579, 1660, 1768, 1822, 1849, 1930, 1957 ], "cnt": 41 }
+{ "ids": [ 12, 255, 256, 337, 418, 499, 580, 661, 715, 823, 877, 904, 1039, 1283, 1363, 1364, 1445, 1526, 1607, 1688, 1742, 1769, 1850, 1931, 1985 ], "cnt": 25 }
+{ "ids": [ 13, 40, 67, 94, 121, 148, 175, 202, 229, 284, 310, 364, 391, 445, 472, 525, 526, 553, 607, 634, 689, 716, 743, 850, 852, 878, 905, 931, 932, 959, 1013, 1067, 1093, 1094, 1121, 1148, 1175, 1202, 1229, 1256, 1310, 1337, 1391, 1418, 1472, 1499, 1553, 1580, 1661, 1689, 1715, 1743, 1770, 1796, 1797, 1824, 1851, 1877, 1905, 1958 ], "cnt": 60 }
+{ "ids": [ 14, 42, 96, 123, 231, 285, 339, 366, 474, 501, 528, 555, 582, 609, 663, 690, 691, 799, 853, 879, 934, 960, 1042, 1150, 1177, 1231, 1258, 1284, 1285, 1393, 1447, 1474, 1501, 1528, 1555, 1609, 1636, 1745, 1799, 1825, 1852, 1853, 1933, 1961 ], "cnt": 44 }
+{ "ids": [ 15, 43, 69, 150, 177, 178, 204, 232, 258, 286, 340, 367, 394, 448, 475, 502, 503, 556, 583, 610, 637, 664, 718, 772, 826, 880, 907, 961, 988, 1043, 1069, 1096, 1178, 1259, 1286, 1340, 1367, 1421, 1475, 1502, 1529, 1582, 1583, 1610, 1637, 1691, 1718, 1746, 1772, 1826, 1880, 1934, 1989 ], "cnt": 53 }
+{ "ids": [ 16, 70, 71, 97, 98, 124, 151, 205, 259, 260, 313, 314, 421, 422, 476, 529, 611, 638, 639, 665, 692, 745, 773, 800, 827, 854, 881, 962, 989, 1016, 1070, 1097, 1124, 1151, 1179, 1205, 1206, 1232, 1260, 1313, 1341, 1368, 1394, 1448, 1530, 1556, 1584, 1664, 1692, 1719, 1773, 1800, 1827, 1881, 1908, 1909, 1935, 1962 ], "cnt": 58 }
+{ "ids": [ 17, 44, 99, 152, 179, 233, 287, 341, 368, 395, 449, 504, 530, 557, 584, 719, 746, 801, 855, 882, 908, 935, 936, 990, 1017, 1071, 1098, 1125, 1152, 1207, 1233, 1287, 1395, 1422, 1449, 1476, 1503, 1504, 1557, 1611, 1638, 1639, 1665, 1775, 1828, 1854, 1855, 1963, 1990 ], "cnt": 49 }
+{ "ids": [ 18, 45, 180, 207, 234, 261, 288, 342, 396, 532, 586, 640, 666, 667, 694, 721, 748, 774, 775, 802, 829, 856, 883, 937, 964, 991, 1018, 1045, 1126, 1180, 1234, 1261, 1315, 1369, 1370, 1423, 1451, 1477, 1505, 1532, 1586, 1640, 1667, 1694, 1721, 1747, 1748, 1774, 1802, 1829, 1856, 1937, 1964, 1991 ], "cnt": 54 }
+{ "ids": [ 19, 73, 154, 235, 289, 316, 370, 451, 505, 613, 641, 722, 857, 938, 1073, 1154, 1208, 1235, 1289, 1342, 1424, 1641, 1776, 1857, 1883, 1938, 1992 ], "cnt": 27 }
+{ "ids": [ 20, 46, 74, 155, 182, 262, 263, 317, 344, 371, 398, 426, 479, 506, 587, 588, 614, 723, 749, 830, 885, 965, 966, 1020, 1074, 1101, 1155, 1181, 1209, 1236, 1290, 1316, 1317, 1344, 1398, 1425, 1452, 1506, 1533, 1560, 1668, 1669, 1749, 1831, 1884, 1911, 1912, 1966 ], "cnt": 48 }
+{ "ids": [ 21, 49, 156, 184, 211, 291, 319, 346, 373, 454, 481, 508, 589, 616, 617, 643, 724, 751, 752, 778, 859, 886, 887, 913, 1021, 1022, 1048, 1156, 1157, 1184, 1211, 1291, 1292, 1319, 1346, 1426, 1427, 1454, 1481, 1589, 1590, 1616, 1643, 1724, 1725, 1751, 1778, 1859, 1860, 1886, 1913, 1940, 1994, 1995 ], "cnt": 54 }
+{ "ids": [ 22, 76, 130, 157, 265, 266, 292, 400, 401, 427, 535, 536, 562, 644, 697, 725, 779, 832, 833, 860, 914, 968, 995, 1049, 1103, 1130, 1238, 1265, 1373, 1400, 1455, 1508, 1535, 1670, 1698, 1805, 1806, 1833, 1914, 1941, 1968 ], "cnt": 41 }
+{ "ids": [ 23, 50, 105, 131, 185, 212, 240, 294, 320, 347, 348, 375, 429, 483, 537, 564, 591, 618, 672, 699, 726, 753, 781, 807, 834, 861, 888, 916, 942, 969, 997, 1023, 1050, 1051, 1077, 1104, 1131, 1132, 1185, 1186, 1240, 1294, 1321, 1347, 1349, 1375, 1429, 1456, 1484, 1510, 1564, 1591, 1618, 1619, 1645, 1699, 1726, 1753, 1780, 1807, 1834, 1888, 1915, 1942, 1969, 1997 ], "cnt": 66 }
+{ "ids": [ 24, 25, 52, 78, 79, 159, 160, 187, 214, 295, 322, 349, 403, 430, 457, 484, 538, 565, 592, 619, 673, 700, 727, 728, 808, 890, 943, 971, 998, 1025, 1052, 1078, 1106, 1160, 1187, 1241, 1268, 1295, 1322, 1376, 1430, 1511, 1538, 1565, 1646, 1673, 1808, 1809, 1836, 1943, 1944, 1971 ], "cnt": 52 }
+{ "ids": [ 26, 80, 188, 269, 404, 431, 459, 539, 566, 620, 674, 756, 809, 837, 864, 944, 972, 1079, 1107, 1134, 1188, 1296, 1377, 1405, 1512, 1647, 1674, 1702, 1782, 1864, 1945, 1999 ], "cnt": 32 }
+{ "ids": [ 27, 134, 135, 243, 270, 351, 378, 405, 567, 568, 594, 702, 703, 946, 1027, 1054, 1135, 1162, 1189, 1242, 1270, 1297, 1378, 1486, 1621, 1703, 1810, 1838, 1972 ], "cnt": 29 }
+{ "ids": [ 28, 136, 163, 271, 298, 325, 406, 434, 460, 487, 541, 569, 595, 677, 704, 730, 839, 920, 1028, 1055, 1217, 1245, 1298, 1488, 1623, 1811, 1866 ], "cnt": 27 }
+{ "ids": [ 29, 56, 245, 272, 380, 433, 461, 488, 515, 542, 758, 813, 866, 893, 948, 974, 1001, 1002, 1029, 1137, 1326, 1353, 1407, 1434, 1461, 1515, 1542, 1650, 1677, 1812, 1893, 1894, 1975 ], "cnt": 33 }
+{ "ids": [ 31, 409, 706, 761, 977, 1274, 1788 ], "cnt": 7 }
+{ "ids": [ 33, 169, 196, 250, 358, 466, 547, 574, 601, 655, 926, 1006, 1087, 1115, 1223, 1331, 1520, 1574, 1628, 1871 ], "cnt": 20 }
+{ "ids": [ 36, 89, 116, 144, 225, 252, 279, 306, 359, 386, 387, 441, 549, 576, 630, 657, 684, 711, 793, 873, 927, 954, 981, 1036, 1117, 1144, 1197, 1198, 1224, 1225, 1360, 1414, 1468, 1495, 1522, 1549, 1684, 1711, 1738, 1765, 1792, 1819, 1874 ], "cnt": 43 }
+{ "ids": [ 37, 308, 334, 416, 442, 605, 794, 983, 1280, 1307, 1361, 1551, 1659, 1712, 1740, 1848, 1929, 1956 ], "cnt": 18 }
+{ "ids": [ 41, 95, 122, 149, 176, 203, 230, 257, 283, 311, 338, 365, 392, 419, 446, 447, 473, 500, 527, 554, 581, 608, 635, 662, 717, 770, 771, 797, 824, 851, 906, 933, 986, 1014, 1040, 1068, 1122, 1149, 1176, 1203, 1230, 1257, 1311, 1338, 1365, 1392, 1419, 1420, 1446, 1473, 1500, 1527, 1554, 1581, 1608, 1635, 1662, 1716, 1717, 1744, 1771, 1878, 1879, 1932, 1959, 1960, 1986, 1987, 1988 ], "cnt": 69 }
+{ "ids": [ 47, 75, 236, 399, 480, 534, 615, 669, 750, 804, 912, 967, 1102, 1183, 1237, 1318, 1372, 1453, 1507, 1588, 1642, 1777, 1993 ], "cnt": 23 }
+{ "ids": [ 48, 102, 129, 210, 237, 264, 318, 345, 372, 453, 561, 670, 777, 805, 940, 993, 1129, 1264, 1345, 1480, 1561, 1696, 1697, 1804, 1832, 1967 ], "cnt": 26 }
+{ "ids": [ 51, 132, 186, 267, 321, 402, 456, 754, 780, 835, 862, 889, 915, 970, 1024, 1105, 1159, 1213, 1267, 1348, 1402, 1403, 1457, 1483, 1537, 1592, 1672, 1700, 1727, 1754, 1781, 1835, 1862, 1889, 1916, 1917, 1970 ], "cnt": 37 }
+{ "ids": [ 53, 162, 486, 513, 621, 648, 729, 999, 1026, 1161, 1540, 1594, 1729, 1756, 1837, 1891 ], "cnt": 16 }
+{ "ids": [ 54, 81, 108, 189, 216, 297, 324, 432, 783, 1081, 1108, 1216, 1243, 1351, 1432, 1459, 1567, 1675 ], "cnt": 18 }
+{ "ids": [ 55, 82, 217, 244, 352, 379, 514, 650, 785, 811, 812, 865, 947, 1082, 1109, 1244, 1379, 1433, 1541, 1595, 1676, 1730, 1839, 1974 ], "cnt": 24 }
+{ "ids": [ 61, 305, 548, 629, 818, 1088, 1169, 1278, 1467, 1656, 1737, 1818, 1899 ], "cnt": 13 }
+{ "ids": [ 62, 143, 251, 332, 522, 792, 819, 900, 1089, 1170, 1359, 1548, 1630, 1657, 1927 ], "cnt": 15 }
+{ "ids": [ 66, 93, 120, 147, 363, 417, 444, 606, 633, 687, 795, 796, 876, 903, 985, 1012, 1146, 1147, 1174, 1201, 1336, 1417, 1444, 1471, 1525, 1714, 1876, 1904 ], "cnt": 28 }
+{ "ids": [ 68, 312, 393, 420, 636, 744, 798, 825, 987, 1015, 1041, 1095, 1123, 1204, 1312, 1339, 1366, 1663, 1690, 1798, 1906, 1907 ], "cnt": 22 }
+{ "ids": [ 72, 125, 126, 153, 206, 315, 369, 423, 450, 477, 531, 558, 585, 612, 693, 720, 747, 828, 909, 963, 1044, 1072, 1099, 1153, 1288, 1314, 1396, 1450, 1531, 1558, 1585, 1612, 1666, 1693, 1720, 1801, 1882, 1936 ], "cnt": 38 }
+{ "ids": [ 77, 103, 104, 158, 213, 238, 239, 293, 374, 428, 455, 482, 509, 510, 563, 590, 645, 671, 698, 806, 941, 996, 1076, 1158, 1212, 1239, 1266, 1293, 1320, 1374, 1401, 1428, 1482, 1509, 1536, 1563, 1617, 1644, 1671, 1752, 1779, 1861, 1887, 1996 ], "cnt": 44 }
+{ "ids": [ 84, 138, 192, 274, 328, 652, 733, 760, 814, 949, 1058, 1084, 1192, 1220, 1246, 1300, 1382, 1436, 1491, 1517, 1679, 1733, 1760, 1814, 1841, 1868, 1950 ], "cnt": 27 }
+{ "ids": [ 85, 166, 220, 301, 382, 437, 599, 626, 653, 680, 707, 788, 815, 869, 1004, 1221, 1248, 1328, 1329, 1437, 1490, 1544, 1789, 1842, 1896, 1923 ], "cnt": 26 }
+{ "ids": [ 86, 302, 329, 356, 410, 464, 491, 546, 950, 951, 1166, 1193, 1518, 1545, 1572, 1599, 1680, 1707, 1734, 1761 ], "cnt": 20 }
+{ "ids": [ 87, 113, 141, 167, 194, 248, 275, 438, 492, 518, 654, 708, 762, 789, 816, 843, 1059, 1113, 1167, 1222, 1276, 1356, 1384, 1410, 1627, 1681, 1843, 1870, 1897, 1924, 1951, 1952, 1978 ], "cnt": 33 }
+{ "ids": [ 88, 628, 899, 1061, 1358, 1601, 1629, 1898, 1926 ], "cnt": 9 }
+{ "ids": [ 100, 127, 181, 208, 209, 343, 397, 424, 425, 452, 478, 533, 559, 560, 668, 695, 776, 803, 884, 910, 911, 992, 1019, 1046, 1100, 1127, 1128, 1262, 1263, 1343, 1371, 1397, 1478, 1479, 1559, 1587, 1613, 1614, 1695, 1722, 1803, 1830, 1910, 1965 ], "cnt": 44 }
+{ "ids": [ 101, 128, 183, 290, 507, 642, 696, 831, 858, 939, 994, 1047, 1075, 1182, 1210, 1399, 1534, 1562, 1615, 1723, 1750, 1858, 1885, 1939 ], "cnt": 24 }
+{ "ids": [ 106, 161, 215, 755, 1214, 1269, 1323, 1404, 1458, 1539, 1593, 1728, 1863, 1998 ], "cnt": 14 }
+{ "ids": [ 107, 133, 242, 268, 296, 376, 377, 458, 511, 512, 593, 646, 647, 701, 782, 836, 863, 917, 945, 1080, 1133, 1215, 1350, 1431, 1485, 1566, 1620, 1701, 1755, 1890 ], "cnt": 30 }
+{ "ids": [ 109, 622, 649, 676, 757, 784, 838, 892, 919, 973, 1000, 1136, 1271, 1325, 1406, 1460, 1514, 1622, 1649, 1704, 1757, 1784, 1865, 1892, 1919, 1946, 1973, 2000 ], "cnt": 28 }
+{ "ids": [ 112, 463, 571, 679, 1031, 1139, 1355, 1571 ], "cnt": 8 }
+{ "ids": [ 118, 226, 280, 307, 415, 496, 523, 550, 685, 848, 875, 982, 1091, 1118, 1171, 1388, 1523, 1550, 1766, 1767, 1821 ], "cnt": 21 }
+{ "ids": [ 140, 221, 545, 572, 734, 896, 1140, 1302, 1383, 1464 ], "cnt": 10 }
+{ "ids": [ 145, 172, 199, 388, 469, 497, 577, 767, 874, 929, 956, 1010, 1145, 1226, 1253, 1415, 1442, 1497, 1631, 1739, 1820, 1928, 1983 ], "cnt": 23 }
+{ "ids": [ 174, 309, 336, 498, 688, 714, 742, 1066, 1228, 1255, 1282, 1606, 1634, 1795, 1823 ], "cnt": 15 }
+{ "ids": [ 193, 247, 544, 842, 1112, 1301, 1652, 1869 ], "cnt": 8 }
+{ "ids": [ 222, 223, 249, 276, 277, 331, 385, 412, 439, 493, 520, 682, 709, 710, 736, 790, 817, 844, 871, 898, 953, 980, 1007, 1033, 1196, 1249, 1250, 1277, 1304, 1412, 1439, 1466, 1493, 1654, 1655, 1682, 1709, 1790, 1817, 1844, 1980 ], "cnt": 41 }
+{ "ids": [ 241, 323, 350, 485, 540, 918, 1053, 1513, 1648 ], "cnt": 9 }
+{ "ids": [ 675, 810, 891, 1324, 1783, 1918 ], "cnt": 6 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_cloud/cluster-by/kmeans-seed/kmeans-seed.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results_cloud/cluster-by/kmeans-seed/kmeans-seed.3.adm
new file mode 100644
index 0000000000..7a9a53b609
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_cloud/cluster-by/kmeans-seed/kmeans-seed.3.adm
@@ -0,0 +1,64 @@
+{ "ids": [ 1, 28, 82, 109, 217, 271, 297, 352, 406, 432, 460, 487, 514, 541, 595, 622, 649, 676, 730, 757, 784, 811, 838, 839, 865, 892, 919, 946, 973, 1000, 1055, 1108, 1136, 1163, 1190, 1217, 1244, 1271, 1298, 1325, 1352, 1379, 1406, 1433, 1460, 1487, 1514, 1541, 1568, 1595, 1622, 1649, 1676, 1704, 1730, 1731, 1757, 1784, 1811, 1839, 1865, 1866, 1892, 1919, 1920, 1946, 1973, 1974, 2000 ], "cnt": 69 }
+{ "ids": [ 2, 83, 110, 137, 138, 164, 218, 272, 327, 353, 354, 407, 435, 462, 489, 543, 570, 596, 623, 651, 678, 705, 731, 732, 786, 840, 894, 921, 922, 975, 1056, 1083, 1111, 1164, 1191, 1218, 1272, 1299, 1380, 1381, 1435, 1462, 1489, 1543, 1569, 1597, 1624, 1651, 1678, 1705, 1759, 1786, 1813, 1840, 1867, 1921, 1948, 1975 ], "cnt": 58 }
+{ "ids": [ 3, 30, 57, 84, 111, 165, 191, 192, 219, 246, 273, 300, 355, 381, 408, 490, 516, 544, 597, 624, 652, 733, 759, 760, 787, 814, 841, 868, 923, 949, 1003, 1030, 1057, 1084, 1138, 1165, 1192, 1219, 1220, 1246, 1273, 1300, 1327, 1354, 1382, 1408, 1491, 1516, 1570, 1598, 1679, 1706, 1732, 1733, 1760, 1787, 1814, 1841, 1868, 1895, 1949, 1976 ], "cnt": 62 }
+{ "ids": [ 4, 112, 463, 571, 679, 1031, 1139, 1247, 1301, 1355, 1517, 1571 ], "cnt": 12 }
+{ "ids": [ 5, 32, 59, 86, 113, 167, 194, 275, 302, 491, 518, 546, 573, 654, 735, 870, 897, 924, 950, 951, 1032, 1059, 1113, 1140, 1275, 1303, 1329, 1356, 1410, 1438, 1518, 1545, 1600, 1681, 1708, 1761, 1762, 1788, 1870 ], "cnt": 39 }
+{ "ids": [ 6, 33, 60, 88, 142, 574, 601, 628, 681, 1033, 1060, 1087, 1601, 1871, 1898 ], "cnt": 15 }
+{ "ids": [ 7, 34, 223, 304, 332, 413, 575, 602, 683, 764, 791, 845, 872, 926, 953, 1034, 1115, 1142, 1170, 1251, 1385, 1440, 1521, 1548, 1602, 1683, 1710, 1764, 1791, 1846, 1872, 1953 ], "cnt": 32 }
+{ "ids": [ 8, 35, 170, 197, 198, 224, 278, 440, 467, 468, 494, 521, 656, 737, 738, 765, 846, 1008, 1035, 1062, 1116, 1143, 1305, 1306, 1413, 1575, 1576, 1603, 1629, 1845, 1873, 1981 ], "cnt": 32 }
+{ "ids": [ 9, 63, 117, 253, 360, 361, 414, 604, 631, 658, 685, 712, 820, 874, 928, 982, 1172, 1199, 1279, 1333, 1387, 1441, 1496, 1577, 1604, 1793, 1847, 1901, 1955 ], "cnt": 29 }
+{ "ids": [ 10, 37, 118, 145, 226, 415, 497, 523, 983, 1091, 1280, 1388, 1685, 1740, 1848, 1929, 1956 ], "cnt": 17 }
+{ "ids": [ 11, 38, 65, 91, 119, 146, 173, 308, 335, 362, 389, 390, 416, 417, 443, 470, 578, 605, 632, 659, 660, 686, 740, 741, 794, 902, 930, 957, 984, 1011, 1038, 1064, 1200, 1227, 1254, 1281, 1308, 1362, 1470, 1524, 1551, 1578, 1579, 1605, 1632, 1633, 1659, 1686, 1822, 1849, 1875, 1876, 1903, 1930 ], "cnt": 54 }
+{ "ids": [ 12, 796, 877, 904, 1283, 1985 ], "cnt": 6 }
+{ "ids": [ 13, 121, 148, 175, 202, 229, 284, 310, 364, 391, 472, 525, 553, 580, 634, 689, 716, 878, 931, 1067, 1093, 1094, 1121, 1148, 1175, 1229, 1310, 1418, 1445, 1472, 1499, 1580, 1661, 1689, 1905, 1958 ], "cnt": 36 }
+{ "ids": [ 14, 42, 122, 285, 393, 474, 528, 663, 690, 771, 798, 879, 960, 987, 1015, 1095, 1258, 1284, 1285, 1366, 1447, 1474, 1501, 1528, 1636, 1663, 1771, 1852, 1906, 1933, 1960, 1988 ], "cnt": 32 }
+{ "ids": [ 15, 43, 69, 177, 178, 232, 258, 286, 367, 448, 475, 502, 503, 556, 583, 610, 664, 718, 772, 826, 880, 907, 935, 961, 988, 1042, 1043, 1178, 1259, 1286, 1367, 1421, 1475, 1502, 1529, 1583, 1610, 1637, 1691, 1746, 1826, 1989 ], "cnt": 42 }
+{ "ids": [ 16, 17, 70, 71, 97, 124, 151, 205, 259, 260, 313, 314, 422, 476, 557, 611, 638, 639, 665, 692, 719, 745, 773, 827, 854, 881, 962, 1016, 1070, 1097, 1124, 1151, 1179, 1205, 1206, 1260, 1313, 1341, 1368, 1394, 1448, 1530, 1556, 1584, 1638, 1665, 1692, 1719, 1773, 1827, 1854, 1881, 1908, 1909, 1962 ], "cnt": 55 }
+{ "ids": [ 18, 45, 180, 207, 235, 289, 342, 396, 532, 559, 586, 613, 694, 721, 748, 775, 883, 910, 964, 991, 1045, 1180, 1235, 1289, 1342, 1343, 1369, 1370, 1397, 1424, 1451, 1478, 1505, 1532, 1559, 1586, 1613, 1667, 1694, 1721, 1747, 1748, 1856, 1883, 1937, 1938 ], "cnt": 46 }
+{ "ids": [ 19, 46, 73, 100, 127, 154, 181, 208, 343, 370, 397, 398, 424, 425, 451, 452, 478, 479, 505, 506, 533, 560, 587, 614, 641, 668, 695, 722, 749, 776, 803, 1046, 1073, 1100, 1127, 1128, 1154, 1155, 1181, 1208, 1209, 1262, 1263, 1290, 1316, 1317, 1344, 1371, 1749, 1776, 1803, 1830, 1831, 1857, 1884, 1910, 1911, 1912, 1965, 1992 ], "cnt": 60 }
+{ "ids": [ 20, 74, 128, 155, 182, 209, 262, 263, 290, 316, 317, 344, 371, 426, 588, 723, 830, 831, 857, 858, 884, 885, 911, 912, 938, 965, 966, 992, 994, 1019, 1020, 1074, 1101, 1398, 1425, 1452, 1479, 1506, 1533, 1534, 1560, 1587, 1614, 1641, 1668, 1669, 1695, 1722, 1966 ], "cnt": 49 }
+{ "ids": [ 21, 49, 76, 130, 156, 184, 211, 265, 291, 319, 346, 373, 400, 454, 481, 508, 535, 589, 616, 617, 643, 724, 751, 752, 778, 859, 886, 887, 913, 914, 968, 1021, 1022, 1049, 1103, 1156, 1157, 1184, 1211, 1238, 1292, 1319, 1346, 1373, 1427, 1454, 1455, 1481, 1508, 1589, 1590, 1616, 1643, 1724, 1725, 1751, 1806, 1859, 1860, 1886, 1941, 1994, 1995 ], "cnt": 63 }
+{ "ids": [ 22, 103, 157, 238, 292, 427, 482, 644, 698, 725, 779, 806, 833, 860, 941, 995, 1076, 1130, 1265, 1320, 1644, 1698, 1779, 1833, 1914, 1968 ], "cnt": 26 }
+{ "ids": [ 23, 77, 104, 158, 185, 213, 266, 293, 294, 320, 374, 375, 401, 429, 510, 591, 645, 726, 781, 861, 888, 942, 996, 1023, 1158, 1185, 1294, 1429, 1510, 1564, 1591, 1645, 1726, 1780, 1861, 1888 ], "cnt": 36 }
+{ "ids": [ 24, 105, 159, 592, 727, 753, 862, 916, 997, 1050, 1051, 1105, 1132, 1186, 1321, 1349, 1456, 1484, 1618, 1619, 1862, 1943, 1997 ], "cnt": 23 }
+{ "ids": [ 25, 51, 132, 160, 186, 187, 267, 295, 321, 322, 402, 430, 457, 484, 565, 619, 700, 754, 780, 889, 890, 915, 1024, 1025, 1052, 1159, 1187, 1213, 1267, 1322, 1348, 1402, 1457, 1483, 1592, 1727, 1754, 1781, 1889, 1916, 1917 ], "cnt": 41 }
+{ "ids": [ 26, 351, 378, 405, 459, 513, 540, 567, 594, 621, 703, 756, 1027, 1053, 1054, 1135, 1162, 1189, 1242, 1621, 1648, 1675, 1702, 1703, 1756, 1783, 1810, 1837 ], "cnt": 28 }
+{ "ids": [ 27, 53, 54, 81, 108, 134, 135, 162, 189, 216, 243, 269, 270, 324, 431, 486, 568, 648, 702, 729, 783, 809, 810, 837, 864, 891, 945, 999, 1026, 1081, 1107, 1134, 1161, 1216, 1243, 1270, 1297, 1324, 1351, 1377, 1378, 1405, 1432, 1459, 1486, 1513, 1539, 1540, 1567, 1594, 1729, 1838, 1891, 1945, 1972, 1999 ], "cnt": 56 }
+{ "ids": [ 29, 55, 56, 190, 245, 325, 379, 380, 433, 434, 461, 488, 515, 650, 758, 785, 813, 866, 893, 920, 947, 948, 974, 1001, 1002, 1029, 1109, 1137, 1326, 1407, 1434, 1461, 1515, 1542, 1650, 1677, 1785, 1812, 1893, 1894 ], "cnt": 40 }
+{ "ids": [ 31, 85, 139, 166, 193, 220, 247, 274, 301, 328, 383, 464, 517, 545, 572, 599, 653, 707, 734, 761, 815, 842, 869, 896, 977, 1004, 1058, 1085, 1112, 1193, 1221, 1274, 1302, 1328, 1437, 1464, 1490, 1544, 1625, 1626, 1653, 1734, 1815, 1869, 1896, 1923, 1950, 1977 ], "cnt": 48 }
+{ "ids": [ 36, 225, 279, 387, 549, 576, 657, 873, 1036, 1117, 1225, 1414, 1495, 1684, 1765 ], "cnt": 15 }
+{ "ids": [ 39, 66, 201, 282, 444, 769, 850, 1012, 1147, 1228, 1309, 1390, 1552, 1877 ], "cnt": 14 }
+{ "ids": [ 40, 67, 94, 257, 635, 662, 743, 1013, 1040, 1202, 1311, 1716, 1743, 1770, 1797 ], "cnt": 15 }
+{ "ids": [ 41, 95, 149, 203, 283, 311, 338, 392, 446, 500, 554, 608, 770, 797, 824, 851, 852, 905, 906, 932, 959, 1014, 1068, 1122, 1176, 1230, 1256, 1257, 1365, 1391, 1419, 1420, 1473, 1527, 1581, 1635, 1662, 1824, 1851, 1878, 1879, 1932, 1986, 1987 ], "cnt": 44 }
+{ "ids": [ 44, 99, 125, 152, 206, 233, 315, 341, 368, 449, 504, 530, 531, 584, 612, 693, 746, 801, 828, 908, 909, 936, 1017, 1044, 1071, 1072, 1098, 1125, 1152, 1207, 1233, 1314, 1422, 1449, 1476, 1504, 1557, 1611, 1612, 1639, 1693, 1720, 1775, 1801, 1828, 1936, 1990 ], "cnt": 47 }
+{ "ids": [ 47, 318, 453, 561, 696, 750, 939, 993, 1129, 1236, 1264, 1399, 1507, 1561, 1642, 1696, 1777, 1804, 1939, 1993 ], "cnt": 20 }
+{ "ids": [ 48, 102, 129, 183, 237, 264, 345, 372, 562, 642, 670, 697, 777, 805, 832, 940, 1075, 1210, 1345, 1400, 1480, 1535, 1562, 1615, 1670, 1778, 1805, 1913, 1940 ], "cnt": 29 }
+{ "ids": [ 50, 212, 240, 347, 348, 456, 483, 564, 618, 1753, 1915 ], "cnt": 11 }
+{ "ids": [ 52, 78, 79, 133, 214, 268, 349, 403, 458, 512, 538, 593, 647, 673, 701, 728, 808, 835, 836, 863, 943, 970, 971, 998, 1078, 1106, 1133, 1160, 1241, 1268, 1295, 1376, 1403, 1430, 1511, 1538, 1565, 1646, 1673, 1674, 1700, 1701, 1808, 1809, 1835, 1836, 1944, 1970, 1971 ], "cnt": 49 }
+{ "ids": [ 58, 382, 409, 436, 598, 625, 706, 895, 976, 1166, 1409, 1436, 1463, 1652, 1922 ], "cnt": 15 }
+{ "ids": [ 61, 305, 548, 629, 818, 899, 1088, 1169, 1278, 1467, 1656, 1737, 1818, 1899, 1926 ], "cnt": 15 }
+{ "ids": [ 62, 89, 116, 143, 144, 251, 306, 359, 386, 441, 522, 630, 684, 711, 792, 819, 900, 927, 954, 981, 1089, 1197, 1224, 1359, 1360, 1468, 1494, 1549, 1630, 1657, 1711, 1738, 1792, 1819, 1874, 1927 ], "cnt": 36 }
+{ "ids": [ 64, 92, 172, 199, 280, 307, 388, 469, 577, 713, 766, 767, 821, 848, 875, 929, 956, 1010, 1037, 1065, 1118, 1145, 1226, 1253, 1334, 1335, 1415, 1442, 1443, 1497, 1523, 1550, 1631, 1713, 1739, 1767, 1794, 1821, 1902, 1983 ], "cnt": 40 }
+{ "ids": [ 68, 176, 230, 365, 419, 447, 473, 527, 581, 717, 744, 825, 933, 986, 1041, 1149, 1203, 1338, 1392, 1446, 1500, 1554, 1608, 1690, 1717, 1744, 1798, 1959 ], "cnt": 28 }
+{ "ids": [ 72, 126, 153, 234, 261, 288, 369, 423, 477, 558, 585, 640, 666, 667, 720, 747, 774, 802, 829, 856, 937, 963, 1018, 1099, 1126, 1153, 1234, 1261, 1288, 1315, 1396, 1423, 1450, 1477, 1531, 1585, 1640, 1774, 1802, 1829, 1882, 1964, 1991 ], "cnt": 43 }
+{ "ids": [ 75, 101, 210, 236, 399, 480, 507, 534, 615, 669, 804, 967, 1047, 1048, 1102, 1182, 1183, 1237, 1291, 1318, 1372, 1426, 1453, 1588, 1723, 1750, 1858, 1885 ], "cnt": 28 }
+{ "ids": [ 80, 106, 107, 161, 188, 215, 241, 242, 296, 323, 350, 376, 377, 404, 485, 511, 539, 566, 620, 646, 674, 675, 755, 782, 917, 918, 944, 972, 1079, 1080, 1188, 1214, 1215, 1269, 1296, 1323, 1350, 1404, 1431, 1458, 1485, 1512, 1566, 1593, 1620, 1647, 1728, 1755, 1782, 1863, 1864, 1890, 1918, 1998 ], "cnt": 54 }
+{ "ids": [ 87, 114, 141, 168, 195, 221, 248, 303, 330, 357, 384, 411, 438, 465, 492, 519, 600, 627, 708, 762, 763, 789, 816, 843, 952, 978, 979, 1005, 1086, 1114, 1141, 1167, 1168, 1195, 1222, 1276, 1330, 1357, 1383, 1384, 1411, 1465, 1492, 1519, 1546, 1547, 1573, 1627, 1735, 1843, 1897, 1924, 1925, 1951, 1952, 1978, 1979 ], "cnt": 57 }
+{ "ids": [ 90, 171, 252, 333, 495, 496, 603, 793, 901, 1009, 1063, 1090, 1171, 1198, 1252, 1469, 1522, 1658, 1766, 1820, 1928, 1982 ], "cnt": 22 }
+{ "ids": [ 93, 255, 418, 607, 661, 795, 823, 1363, 1525, 1526, 1688, 1715, 1931 ], "cnt": 13 }
+{ "ids": [ 96, 123, 150, 204, 231, 312, 339, 340, 366, 394, 420, 501, 555, 582, 609, 636, 691, 799, 853, 934, 1069, 1096, 1123, 1150, 1177, 1204, 1231, 1312, 1339, 1393, 1555, 1582, 1609, 1718, 1745, 1799, 1825, 1853, 1907, 1934, 1961 ], "cnt": 41 }
+{ "ids": [ 98, 179, 287, 395, 450, 855, 882, 990, 1287, 1395, 1558, 1666, 1855, 1963 ], "cnt": 14 }
+{ "ids": [ 115, 169, 196, 250, 385, 412, 466, 547, 655, 709, 925, 980, 1006, 1223, 1277, 1304, 1493, 1520, 1574, 1682 ], "cnt": 20 }
+{ "ids": [ 120, 200, 227, 228, 254, 281, 471, 524, 551, 552, 579, 606, 633, 768, 822, 849, 903, 958, 1092, 1119, 1120, 1146, 1173, 1174, 1201, 1389, 1416, 1471, 1498, 1660, 1687, 1714, 1741, 1768, 1957, 1984 ], "cnt": 36 }
+{ "ids": [ 131, 239, 537, 672, 699, 807, 834, 969, 1104, 1131, 1240, 1266, 1347, 1375, 1537, 1672, 1699, 1834, 1969 ], "cnt": 19 }
+{ "ids": [ 136, 163, 244, 298, 299, 326, 542, 569, 677, 704, 812, 867, 1028, 1082, 1110, 1245, 1353, 1488, 1596, 1623, 1758, 1947 ], "cnt": 22 }
+{ "ids": [ 140, 329, 356, 410, 437, 626, 680, 788, 1194, 1248, 1572, 1599, 1680, 1707, 1789, 1816, 1842 ], "cnt": 17 }
+{ "ids": [ 147, 174, 309, 336, 363, 498, 687, 714, 715, 742, 876, 1066, 1255, 1282, 1417, 1444, 1606, 1634, 1769, 1795, 1823 ], "cnt": 21 }
+{ "ids": [ 222, 249, 276, 277, 331, 358, 439, 493, 520, 682, 710, 736, 790, 817, 844, 871, 898, 1007, 1061, 1196, 1249, 1250, 1331, 1358, 1412, 1439, 1466, 1628, 1654, 1655, 1709, 1736, 1763, 1790, 1817, 1844, 1980 ], "cnt": 37 }
+{ "ids": [ 256, 337, 445, 499, 526, 688, 985, 1039, 1336, 1337, 1364, 1553, 1607, 1742, 1796, 1850, 1904 ], "cnt": 17 }
+{ "ids": [ 334, 442, 550, 739, 847, 955, 1144, 1307, 1361, 1712 ], "cnt": 10 }
+{ "ids": [ 421, 529, 637, 800, 989, 1232, 1340, 1503, 1664, 1772, 1800, 1880, 1935 ], "cnt": 13 }
+{ "ids": [ 428, 509, 536, 563, 590, 671, 1239, 1293, 1401, 1428, 1482, 1536, 1563, 1617, 1671, 1752, 1887, 1996 ], "cnt": 18 }
+{ "ids": [ 455, 1077, 1212, 1374, 1509, 1807, 1942 ], "cnt": 7 }
+{ "ids": [ 1332, 1386, 1900, 1954 ], "cnt": 4 }
+{ "ids": [ 1697, 1832, 1967 ], "cnt": 3 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_cloud/cluster-by/kmeans-seed/kmeans-seed.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results_cloud/cluster-by/kmeans-seed/kmeans-seed.4.adm
new file mode 100644
index 0000000000..35f25b69a2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_cloud/cluster-by/kmeans-seed/kmeans-seed.4.adm
@@ -0,0 +1,64 @@
+{ "ids": [ 1, 56, 136, 163, 190, 217, 244, 271, 298, 325, 352, 379, 433, 434, 461, 488, 569, 650, 704, 758, 785, 812, 839, 893, 920, 947, 974, 1028, 1055, 1082, 1109, 1163, 1244, 1326, 1352, 1379, 1461, 1515, 1542, 1731, 1920, 1947, 1974 ], "cnt": 43 }
+{ "ids": [ 2, 83, 327, 407, 515, 867, 948, 975, 1056, 1380, 1488, 1597, 1624, 1785, 1840, 1921, 1948 ], "cnt": 17 }
+{ "ids": [ 3, 30, 57, 111, 165, 191, 219, 246, 273, 355, 408, 435, 490, 570, 624, 651, 679, 759, 787, 868, 923, 1030, 1057, 1138, 1165, 1219, 1273, 1300, 1327, 1354, 1355, 1381, 1408, 1516, 1543, 1598, 1705, 1706, 1732, 1787, 1895, 1976 ], "cnt": 42 }
+{ "ids": [ 4, 85, 382, 653, 976, 1112, 1328, 1409, 1490 ], "cnt": 9 }
+{ "ids": [ 5, 32, 59, 86, 193, 329, 356, 410, 437, 546, 626, 680, 761, 788, 842, 897, 950, 951, 1194, 1248, 1275, 1329, 1518, 1599, 1680, 1707, 1789, 1842, 1869, 1923 ], "cnt": 30 }
+{ "ids": [ 6, 87, 114, 140, 141, 142, 168, 195, 248, 303, 330, 384, 411, 465, 492, 519, 573, 600, 627, 681, 708, 763, 789, 816, 870, 925, 952, 978, 979, 1005, 1060, 1086, 1114, 1141, 1167, 1168, 1195, 1222, 1276, 1330, 1357, 1383, 1384, 1411, 1438, 1465, 1519, 1546, 1547, 1573, 1627, 1735, 1762, 1816, 1843, 1924, 1925, 1951, 1952, 1979 ], "cnt": 60 }
+{ "ids": [ 7, 88, 169, 223, 250, 277, 331, 466, 547, 817, 844, 899, 953, 1061, 1196, 1278, 1358, 1412, 1548, 1601, 1629, 1682, 1818, 1872, 1926, 1980 ], "cnt": 26 }
+{ "ids": [ 8, 35, 170, 197, 198, 278, 440, 467, 468, 522, 737, 738, 765, 792, 846, 1008, 1035, 1062, 1116, 1143, 1305, 1306, 1386, 1575, 1576, 1603, 1630, 1657, 1845, 1873, 1900, 1954, 1981 ], "cnt": 33 }
+{ "ids": [ 9, 63, 145, 226, 414, 495, 577, 603, 604, 631, 685, 820, 928, 982, 1009, 1199, 1333, 1604, 1658, 1685, 1847, 1901 ], "cnt": 22 }
+{ "ids": [ 10, 172, 253, 658, 821, 1145, 1172, 1226, 1496, 1577, 1713 ], "cnt": 11 }
+{ "ids": [ 11, 38, 65, 91, 119, 146, 200, 227, 254, 281, 308, 335, 362, 389, 390, 443, 470, 524, 551, 578, 632, 633, 659, 660, 740, 768, 822, 849, 903, 930, 957, 984, 1038, 1064, 1092, 1119, 1146, 1173, 1200, 1227, 1254, 1281, 1308, 1362, 1389, 1416, 1443, 1470, 1524, 1605, 1632, 1633, 1660, 1687, 1714, 1741, 1768, 1822, 1849, 1875, 1876, 1903, 1930, 1957, 1984 ], "cnt": 65 }
+{ "ids": [ 12, 39, 66, 93, 120, 147, 174, 201, 228, 255, 282, 309, 336, 363, 417, 418, 444, 471, 498, 552, 579, 606, 607, 687, 714, 715, 741, 742, 769, 795, 796, 876, 877, 958, 985, 1011, 1012, 1039, 1066, 1120, 1147, 1174, 1201, 1228, 1255, 1282, 1309, 1336, 1363, 1390, 1417, 1444, 1471, 1498, 1525, 1526, 1552, 1579, 1606, 1634, 1715, 1769, 1795, 1823, 1877, 1904, 1985 ], "cnt": 67 }
+{ "ids": [ 13, 121, 148, 175, 202, 229, 284, 310, 337, 391, 445, 525, 526, 553, 580, 634, 661, 689, 716, 743, 797, 823, 850, 852, 905, 931, 932, 959, 1013, 1093, 1121, 1148, 1202, 1256, 1310, 1337, 1364, 1391, 1445, 1499, 1553, 1607, 1661, 1688, 1689, 1742, 1797, 1824, 1850, 1851, 1905, 1931, 1958 ], "cnt": 53 }
+{ "ids": [ 14, 42, 96, 123, 150, 231, 258, 285, 312, 393, 420, 474, 501, 555, 582, 609, 636, 663, 798, 799, 853, 879, 960, 987, 1015, 1123, 1150, 1177, 1204, 1284, 1285, 1312, 1339, 1366, 1447, 1474, 1501, 1528, 1555, 1582, 1609, 1636, 1663, 1798, 1825, 1852, 1853, 1907 ], "cnt": 48 }
+{ "ids": [ 15, 43, 69, 177, 232, 286, 367, 421, 475, 502, 503, 529, 583, 610, 637, 664, 718, 772, 826, 880, 907, 961, 988, 1043, 1178, 1232, 1259, 1286, 1340, 1367, 1421, 1475, 1502, 1529, 1583, 1610, 1664, 1691, 1718, 1746, 1772, 1826, 1880, 1989 ], "cnt": 44 }
+{ "ids": [ 16, 178, 179, 395, 719, 746, 935, 1314, 1422, 1638, 1854 ], "cnt": 11 }
+{ "ids": [ 17, 44, 70, 71, 97, 124, 313, 530, 557, 584, 611, 638, 665, 692, 745, 989, 1016, 1070, 1097, 1124, 1151, 1179, 1205, 1206, 1233, 1260, 1313, 1448, 1556, 1665, 1692, 1719, 1773, 1800, 1827, 1881, 1908 ], "cnt": 37 }
+{ "ids": [ 18, 45, 46, 73, 100, 154, 180, 181, 208, 235, 289, 343, 370, 396, 397, 424, 425, 478, 505, 532, 559, 560, 586, 613, 694, 721, 748, 749, 775, 803, 910, 964, 992, 1046, 1127, 1128, 1154, 1180, 1235, 1262, 1289, 1342, 1343, 1369, 1370, 1424, 1451, 1478, 1505, 1532, 1559, 1667, 1694, 1721, 1748, 1830, 1856, 1883, 1910, 1937, 1938 ], "cnt": 61 }
+{ "ids": [ 19, 20, 74, 101, 127, 128, 155, 182, 209, 236, 262, 263, 290, 316, 317, 344, 371, 398, 426, 452, 479, 506, 533, 587, 588, 614, 641, 668, 695, 722, 723, 776, 830, 831, 857, 858, 884, 911, 912, 938, 939, 965, 966, 994, 1019, 1020, 1073, 1074, 1100, 1101, 1155, 1181, 1182, 1208, 1209, 1236, 1263, 1290, 1316, 1317, 1344, 1371, 1398, 1425, 1452, 1479, 1506, 1533, 1534, 1560, 1587, 1614, 1641, 1668, 1669, 1695, 1722, 1749, 1776, 1803, 1831, 1857, 1858, 1884, 1885, 1911, 1912, 1939,  [...]
+{ "ids": [ 21, 49, 130, 156, 184, 211, 265, 291, 319, 346, 373, 454, 481, 508, 562, 589, 616, 643, 697, 724, 751, 778, 832, 859, 886, 887, 913, 1021, 1022, 1156, 1157, 1184, 1211, 1292, 1319, 1346, 1400, 1427, 1454, 1481, 1508, 1535, 1589, 1616, 1643, 1670, 1724, 1725, 1751, 1778, 1805, 1859, 1860, 1886, 1913, 1940, 1994, 1995 ], "cnt": 58 }
+{ "ids": [ 22, 76, 103, 157, 238, 292, 400, 427, 428, 482, 535, 563, 644, 698, 725, 779, 806, 833, 860, 914, 941, 968, 995, 1049, 1076, 1103, 1130, 1238, 1265, 1320, 1373, 1644, 1671, 1698, 1752, 1779, 1806, 1833, 1887, 1914, 1941, 1968 ], "cnt": 42 }
+{ "ids": [ 23, 77, 185, 212, 347, 374, 429, 455, 509, 591, 645, 671, 781, 1212, 1239, 1293, 1374, 1428, 1509, 1536, 1780, 1807, 1888, 1942 ], "cnt": 24 }
+{ "ids": [ 24, 51, 105, 132, 159, 186, 267, 294, 321, 402, 484, 565, 592, 619, 700, 727, 753, 754, 780, 862, 889, 915, 916, 997, 1024, 1050, 1051, 1105, 1132, 1159, 1186, 1267, 1321, 1348, 1349, 1375, 1402, 1456, 1483, 1484, 1618, 1619, 1672, 1754, 1835, 1862, 1889, 1916, 1917, 1970, 1997 ], "cnt": 51 }
+{ "ids": [ 25, 78, 79, 160, 187, 214, 295, 322, 349, 403, 430, 457, 538, 673, 808, 835, 890, 943, 970, 971, 1025, 1078, 1106, 1160, 1213, 1241, 1295, 1376, 1403, 1430, 1511, 1538, 1565, 1646, 1673, 1700, 1781, 1808, 1809, 1943, 1944 ], "cnt": 41 }
+{ "ids": [ 26, 27, 53, 134, 135, 162, 270, 324, 351, 378, 405, 459, 486, 513, 540, 567, 568, 594, 621, 648, 702, 729, 810, 999, 1027, 1081, 1135, 1162, 1189, 1242, 1270, 1378, 1513, 1540, 1594, 1621, 1648, 1675, 1702, 1703, 1729, 1756, 1783, 1810, 1837, 1838, 1972, 1999 ], "cnt": 48 }
+{ "ids": [ 28, 460, 595, 730, 811, 946, 1054, 1217, 1298, 1325, 1460, 1487, 1514, 1595, 1730, 1811, 1866, 1946 ], "cnt": 18 }
+{ "ids": [ 29, 137, 300, 354, 380, 462, 516, 597, 705, 813, 895, 921, 922, 1002, 1110, 1164, 1353, 1407, 1435, 1489, 1570, 1678, 1758, 1786, 1894, 1975 ], "cnt": 26 }
+{ "ids": [ 31, 58, 247, 409, 544, 625, 706, 977, 1004, 1084, 1139, 1166, 1274, 1301, 1463, 1625, 1652, 1733 ], "cnt": 18 }
+{ "ids": [ 33, 115, 196, 358, 574, 601, 655, 764, 845, 926, 1006, 1087, 1115, 1223, 1331, 1385, 1493, 1520, 1574, 1628, 1655, 1871, 1898 ], "cnt": 23 }
+{ "ids": [ 34, 62, 89, 116, 143, 224, 251, 304, 332, 359, 413, 494, 521, 575, 602, 656, 683, 791, 819, 872, 927, 954, 1034, 1089, 1142, 1170, 1224, 1251, 1332, 1359, 1413, 1440, 1494, 1521, 1602, 1683, 1710, 1791, 1792, 1846, 1927, 1953 ], "cnt": 42 }
+{ "ids": [ 36, 117, 225, 279, 360, 361, 387, 441, 549, 657, 712, 793, 874, 1036, 1117, 1225, 1279, 1387, 1441, 1495, 1549, 1793, 1955 ], "cnt": 23 }
+{ "ids": [ 37, 334, 415, 523, 794, 902, 983, 1091, 1280, 1307, 1388, 1551, 1740, 1848, 1929, 1956 ], "cnt": 16 }
+{ "ids": [ 40, 67, 94, 256, 364, 472, 499, 688, 878, 904, 1067, 1094, 1175, 1229, 1283, 1418, 1472, 1580, 1743, 1770, 1796, 1932, 1986 ], "cnt": 23 }
+{ "ids": [ 41, 68, 95, 122, 149, 176, 203, 230, 257, 283, 311, 338, 365, 392, 419, 446, 447, 473, 500, 527, 554, 581, 608, 635, 662, 690, 717, 744, 770, 771, 824, 825, 851, 906, 933, 986, 1014, 1040, 1041, 1068, 1095, 1122, 1149, 1176, 1203, 1230, 1257, 1311, 1338, 1365, 1392, 1419, 1420, 1446, 1473, 1500, 1527, 1554, 1581, 1608, 1635, 1662, 1690, 1716, 1717, 1744, 1771, 1878, 1879, 1906, 1933, 1959, 1960, 1987, 1988 ], "cnt": 75 }
+{ "ids": [ 47, 75, 129, 210, 264, 345, 399, 480, 534, 615, 669, 750, 804, 885, 967, 1047, 1048, 1102, 1183, 1237, 1291, 1318, 1372, 1426, 1453, 1507, 1588, 1642, 1723, 1777 ], "cnt": 30 }
+{ "ids": [ 48, 102, 183, 237, 318, 372, 453, 507, 561, 642, 670, 696, 777, 805, 940, 993, 1075, 1210, 1264, 1345, 1399, 1480, 1561, 1615, 1696, 1750, 1804, 1993 ], "cnt": 28 }
+{ "ids": [ 50, 131, 240, 348, 456, 483, 537, 564, 618, 699, 1347, 1753, 1915, 1969 ], "cnt": 14 }
+{ "ids": [ 52, 107, 242, 376, 377, 458, 511, 593, 646, 728, 863, 945, 998, 1080, 1133, 1215, 1268, 1296, 1350, 1431, 1485, 1566, 1620, 1674, 1701, 1755, 1836, 1864, 1890, 1971 ], "cnt": 30 }
+{ "ids": [ 54, 81, 108, 189, 216, 243, 297, 432, 622, 891, 1108, 1216, 1243, 1297, 1324, 1351, 1432, 1459, 1486, 1567, 1784, 1865, 1919 ], "cnt": 23 }
+{ "ids": [ 55, 82, 1812, 1893 ], "cnt": 4 }
+{ "ids": [ 60, 222, 249, 276, 385, 412, 439, 493, 520, 628, 682, 709, 710, 736, 790, 871, 898, 980, 1007, 1033, 1249, 1250, 1277, 1304, 1439, 1466, 1654, 1709, 1736, 1763, 1790, 1817, 1844 ], "cnt": 33 }
+{ "ids": [ 61, 305, 386, 548, 629, 818, 1088, 1169, 1197, 1467, 1656, 1737, 1764, 1899 ], "cnt": 14 }
+{ "ids": [ 64, 92, 118, 173, 199, 280, 307, 416, 469, 605, 686, 713, 766, 767, 848, 875, 929, 956, 1010, 1037, 1065, 1118, 1253, 1334, 1335, 1442, 1497, 1523, 1550, 1578, 1631, 1659, 1686, 1739, 1767, 1794, 1821, 1902, 1983 ], "cnt": 39 }
+{ "ids": [ 72, 99, 126, 206, 315, 368, 450, 504, 531, 585, 855, 882, 908, 909, 936, 1044, 1071, 1072, 1098, 1152, 1153, 1207, 1476, 1504, 1558, 1612, 1639, 1666, 1775, 1882, 1936, 1963 ], "cnt": 32 }
+{ "ids": [ 80, 106, 161, 188, 215, 241, 269, 323, 350, 404, 431, 485, 539, 566, 620, 674, 675, 756, 783, 809, 837, 864, 918, 944, 972, 1026, 1053, 1079, 1107, 1134, 1161, 1188, 1214, 1269, 1323, 1377, 1404, 1405, 1458, 1512, 1539, 1593, 1647, 1728, 1782, 1891, 1918, 1945 ], "cnt": 48 }
+{ "ids": [ 84, 112, 192, 274, 381, 463, 571, 652, 733, 760, 814, 841, 949, 1003, 1031, 1058, 1192, 1220, 1246, 1382, 1436, 1491, 1517, 1571, 1679, 1760, 1814, 1841, 1868, 1949, 1950 ], "cnt": 31 }
+{ "ids": [ 90, 171, 333, 388, 442, 496, 497, 550, 739, 847, 901, 955, 1063, 1144, 1171, 1252, 1361, 1415, 1469, 1712, 1766, 1820, 1928 ], "cnt": 23 }
+{ "ids": [ 98, 151, 152, 205, 233, 259, 260, 314, 341, 422, 476, 639, 773, 800, 801, 854, 881, 962, 1125, 1287, 1341, 1368, 1394, 1449, 1503, 1530, 1584, 1611, 1828, 1909, 1962, 1990 ], "cnt": 32 }
+{ "ids": [ 104, 213, 239, 266, 401, 510, 672, 807, 834, 969, 1104, 1131, 1240, 1266, 1401, 1482, 1537, 1563, 1617, 1699, 1834, 1861, 1996 ], "cnt": 23 }
+{ "ids": [ 109, 406, 487, 514, 541, 649, 676, 703, 757, 784, 838, 865, 892, 919, 973, 1000, 1136, 1190, 1271, 1406, 1433, 1541, 1568, 1622, 1649, 1676, 1704, 1757, 1839, 1892, 1973, 2000 ], "cnt": 32 }
+{ "ids": [ 110, 138, 218, 299, 326, 489, 543, 623, 678, 731, 732, 786, 840, 894, 1083, 1111, 1191, 1299, 1462, 1596, 1651, 1759, 1813, 1867 ], "cnt": 24 }
+{ "ids": [ 113, 167, 194, 275, 357, 438, 491, 518, 599, 654, 735, 762, 843, 924, 1032, 1059, 1113, 1303, 1356, 1410, 1437, 1492, 1600, 1681, 1708, 1761, 1870, 1897, 1978 ], "cnt": 29 }
+{ "ids": [ 125, 153, 207, 234, 288, 369, 423, 477, 558, 612, 666, 693, 720, 747, 802, 828, 937, 963, 991, 1126, 1261, 1288, 1315, 1396, 1423, 1450, 1531, 1585, 1640, 1693, 1720, 1747, 1774, 1801, 1829, 1964 ], "cnt": 36 }
+{ "ids": [ 133, 268, 296, 512, 647, 701, 755, 782, 836, 917, 1052, 1187, 1322, 1457, 1592, 1727, 1863, 1998 ], "cnt": 18 }
+{ "ids": [ 139, 221, 302, 464, 517, 707, 734, 1085, 1140, 1193, 1247, 1302, 1545, 1572, 1626, 1653, 1734, 1788, 1815, 1977 ], "cnt": 20 }
+{ "ids": [ 144, 252, 306, 576, 630, 684, 711, 873, 900, 981, 1090, 1198, 1360, 1414, 1468, 1522, 1684, 1711, 1738, 1765, 1819, 1874, 1982 ], "cnt": 23 }
+{ "ids": [ 158, 293, 320, 375, 590, 726, 861, 888, 942, 996, 1023, 1077, 1158, 1185, 1294, 1429, 1510, 1564, 1591, 1645, 1726 ], "cnt": 21 }
+{ "ids": [ 164, 245, 272, 353, 542, 596, 677, 866, 1001, 1029, 1137, 1218, 1245, 1272, 1434, 1569, 1623, 1650, 1677 ], "cnt": 19 }
+{ "ids": [ 166, 220, 301, 328, 383, 436, 545, 572, 598, 815, 869, 896, 1221, 1464, 1544, 1896, 1922 ], "cnt": 17 }
+{ "ids": [ 204, 339, 340, 366, 394, 448, 528, 556, 691, 934, 1042, 1069, 1096, 1231, 1258, 1393, 1637, 1745, 1799, 1934, 1961 ], "cnt": 21 }
+{ "ids": [ 261, 342, 451, 640, 667, 774, 829, 856, 883, 1018, 1045, 1099, 1234, 1397, 1477, 1586, 1613, 1802, 1991 ], "cnt": 19 }
+{ "ids": [ 287, 449, 827, 990, 1017, 1395, 1557, 1855, 1935 ], "cnt": 9 }
+{ "ids": [ 536, 617, 752, 1455, 1590 ], "cnt": 5 }
+{ "ids": [ 1129, 1562, 1697, 1832, 1967 ], "cnt": 5 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_cloud/cluster-by/kmeans-seed/kmeans-seed.5.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results_cloud/cluster-by/kmeans-seed/kmeans-seed.5.adm
new file mode 100644
index 0000000000..543ac72db3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_cloud/cluster-by/kmeans-seed/kmeans-seed.5.adm
@@ -0,0 +1,64 @@
+{ "ids": [ 1, 28, 109, 595, 622, 730, 757, 892, 1163, 1190, 1217, 1298, 1325, 1460, 1487, 1514, 1622, 1649, 1731, 1784, 1811, 1866, 1947 ], "cnt": 23 }
+{ "ids": [ 2, 83, 110, 137, 164, 218, 299, 326, 327, 353, 407, 489, 543, 596, 623, 731, 732, 786, 840, 867, 894, 975, 1056, 1083, 1110, 1191, 1218, 1272, 1299, 1380, 1462, 1569, 1596, 1597, 1624, 1651, 1678, 1759, 1813, 1840, 1867, 1948 ], "cnt": 42 }
+{ "ids": [ 3, 30, 57, 111, 138, 165, 191, 219, 246, 273, 300, 354, 355, 408, 435, 462, 490, 516, 570, 597, 624, 651, 678, 705, 759, 787, 895, 921, 922, 923, 1030, 1057, 1111, 1138, 1164, 1165, 1219, 1246, 1273, 1300, 1327, 1354, 1381, 1435, 1489, 1543, 1570, 1598, 1679, 1705, 1706, 1732, 1786, 1787, 1895, 1921 ], "cnt": 56 }
+{ "ids": [ 4, 58, 409, 436, 544, 598, 625, 679, 733, 1084, 1301, 1355, 1409, 1463, 1652, 1733 ], "cnt": 16 }
+{ "ids": [ 5, 86, 167, 194, 356, 410, 546, 599, 626, 680, 762, 788, 842, 951, 1194, 1248, 1410, 1437, 1599, 1707, 1789, 1842, 1869, 1923 ], "cnt": 24 }
+{ "ids": [ 6, 32, 33, 59, 60, 87, 113, 114, 140, 141, 142, 168, 195, 248, 275, 303, 330, 357, 384, 411, 438, 465, 492, 518, 519, 573, 600, 627, 654, 681, 708, 735, 763, 789, 816, 843, 870, 897, 924, 925, 952, 978, 979, 1005, 1006, 1032, 1059, 1060, 1086, 1113, 1114, 1141, 1167, 1168, 1195, 1222, 1275, 1276, 1303, 1330, 1356, 1357, 1383, 1384, 1411, 1438, 1465, 1492, 1519, 1546, 1547, 1573, 1600, 1627, 1681, 1708, 1735, 1762, 1816, 1843, 1870, 1871, 1897, 1924, 1925, 1951, 1952, 1978, 197 [...]
+{ "ids": [ 7, 34, 61, 115, 196, 304, 305, 332, 413, 548, 575, 601, 602, 629, 683, 764, 791, 818, 845, 872, 926, 1034, 1088, 1115, 1142, 1169, 1170, 1223, 1251, 1278, 1332, 1385, 1440, 1521, 1548, 1602, 1656, 1683, 1710, 1737, 1764, 1791, 1818, 1846, 1872, 1899, 1953 ], "cnt": 47 }
+{ "ids": [ 8, 35, 89, 116, 170, 197, 198, 224, 278, 359, 386, 387, 440, 467, 468, 494, 521, 549, 576, 656, 657, 684, 737, 738, 765, 846, 873, 927, 954, 1008, 1035, 1036, 1062, 1116, 1117, 1143, 1197, 1224, 1225, 1305, 1306, 1386, 1413, 1414, 1467, 1494, 1495, 1575, 1576, 1603, 1629, 1684, 1765, 1792, 1845, 1873, 1900, 1954, 1981 ], "cnt": 59 }
+{ "ids": [ 9, 63, 117, 171, 226, 253, 307, 333, 360, 414, 603, 604, 631, 658, 685, 712, 820, 901, 928, 982, 1009, 1063, 1145, 1172, 1199, 1226, 1279, 1333, 1387, 1441, 1469, 1496, 1577, 1604, 1766, 1793, 1847, 1901, 1955, 1982 ], "cnt": 40 }
+{ "ids": [ 10, 37, 415, 523, 983, 1091, 1280, 1307, 1388, 1551, 1685, 1740, 1848, 1929, 1956 ], "cnt": 15 }
+{ "ids": [ 11, 65, 119, 281, 389, 390, 417, 443, 524, 578, 632, 633, 660, 740, 741, 768, 794, 849, 902, 903, 930, 957, 1011, 1038, 1064, 1092, 1146, 1200, 1201, 1254, 1308, 1309, 1362, 1470, 1524, 1579, 1632, 1660, 1714, 1822, 1849, 1876, 1903, 1930, 1957, 1984 ], "cnt": 46 }
+{ "ids": [ 12, 39, 120, 147, 201, 227, 228, 282, 309, 471, 498, 552, 579, 606, 795, 822, 876, 958, 1066, 1120, 1174, 1228, 1255, 1336, 1390, 1417, 1444, 1471, 1498, 1525, 1768, 1769, 1795, 1823, 1985 ], "cnt": 35 }
+{ "ids": [ 13, 121, 148, 175, 255, 284, 310, 364, 391, 418, 472, 525, 553, 607, 634, 661, 716, 769, 823, 850, 877, 878, 904, 1093, 1121, 1148, 1175, 1202, 1229, 1363, 1418, 1472, 1499, 1526, 1580, 1661, 1689, 1715, 1877, 1931, 1958 ], "cnt": 41 }
+{ "ids": [ 14, 338, 474, 528, 555, 663, 906, 960, 1258, 1284, 1285, 1474, 1852, 1879, 1906, 1933 ], "cnt": 16 }
+{ "ids": [ 15, 69, 150, 178, 204, 232, 286, 340, 394, 475, 556, 610, 637, 718, 772, 853, 907, 961, 1043, 1069, 1096, 1178, 1231, 1340, 1367, 1421, 1475, 1529, 1555, 1582, 1583, 1637, 1718, 1746, 1772, 1799, 1880 ], "cnt": 37 }
+{ "ids": [ 16, 43, 124, 151, 177, 259, 367, 448, 502, 583, 611, 664, 691, 719, 746, 826, 827, 854, 880, 934, 935, 962, 988, 1042, 1070, 1151, 1259, 1286, 1394, 1422, 1502, 1530, 1610, 1638, 1691, 1826, 1854, 1934, 1962, 1989 ], "cnt": 40 }
+{ "ids": [ 17, 44, 70, 71, 97, 205, 233, 260, 313, 314, 421, 422, 449, 476, 529, 530, 557, 584, 638, 639, 665, 692, 745, 773, 800, 801, 881, 989, 1016, 1097, 1124, 1179, 1205, 1206, 1232, 1233, 1260, 1313, 1341, 1368, 1448, 1449, 1503, 1556, 1557, 1584, 1611, 1664, 1665, 1692, 1719, 1773, 1800, 1827, 1881, 1908, 1909, 1935 ], "cnt": 58 }
+{ "ids": [ 18, 45, 180, 342, 559, 586, 613, 721, 748, 883, 910, 1045, 1180, 1424, 1451, 1478, 1559, 1586, 1613, 1721, 1748, 1883 ], "cnt": 22 }
+{ "ids": [ 19, 73, 127, 208, 316, 398, 451, 452, 505, 533, 641, 668, 695, 722, 776, 911, 1073, 1100, 1154, 1208, 1263, 1343, 1371, 1397, 1776, 1803, 1831, 1857, 1911, 1965, 1992 ], "cnt": 31 }
+{ "ids": [ 20, 74, 101, 128, 155, 182, 209, 262, 263, 290, 317, 344, 371, 426, 479, 506, 587, 588, 723, 830, 831, 858, 884, 885, 912, 965, 966, 994, 1019, 1020, 1074, 1101, 1155, 1209, 1236, 1290, 1344, 1398, 1425, 1452, 1479, 1506, 1533, 1534, 1560, 1587, 1614, 1641, 1668, 1669, 1722, 1777, 1885, 1912, 1966 ], "cnt": 55 }
+{ "ids": [ 21, 48, 49, 130, 156, 183, 184, 211, 265, 291, 318, 319, 346, 373, 454, 481, 508, 589, 616, 617, 643, 724, 751, 752, 778, 859, 886, 887, 913, 1021, 1022, 1048, 1156, 1157, 1211, 1291, 1292, 1319, 1346, 1426, 1427, 1454, 1481, 1508, 1589, 1590, 1616, 1643, 1724, 1725, 1751, 1859, 1860, 1886, 1994, 1995 ], "cnt": 56 }
+{ "ids": [ 22, 76, 266, 400, 401, 509, 535, 536, 644, 725, 779, 860, 914, 968, 1049, 1103, 1184, 1238, 1373, 1455, 1482, 1563, 1617, 1671, 1698, 1806, 1941 ], "cnt": 27 }
+{ "ids": [ 23, 77, 158, 185, 212, 213, 293, 294, 320, 347, 374, 375, 429, 510, 591, 645, 672, 726, 781, 807, 861, 888, 942, 996, 997, 1023, 1077, 1104, 1158, 1185, 1212, 1294, 1374, 1429, 1509, 1510, 1564, 1591, 1645, 1726, 1780, 1807, 1861, 1888, 1942, 1997 ], "cnt": 46 }
+{ "ids": [ 24, 25, 52, 78, 79, 159, 160, 187, 214, 295, 322, 349, 403, 430, 457, 538, 592, 673, 727, 728, 808, 863, 890, 943, 971, 998, 1025, 1078, 1106, 1160, 1241, 1268, 1295, 1376, 1430, 1511, 1538, 1565, 1646, 1673, 1808, 1809, 1836, 1943, 1944, 1971 ], "cnt": 46 }
+{ "ids": [ 26, 80, 161, 188, 269, 323, 404, 459, 539, 566, 620, 674, 675, 756, 809, 837, 864, 944, 972, 1053, 1079, 1107, 1134, 1188, 1269, 1296, 1377, 1404, 1405, 1431, 1512, 1647, 1674, 1702, 1728, 1782, 1783, 1864, 1918, 1945, 1999 ], "cnt": 41 }
+{ "ids": [ 27, 53, 54, 81, 108, 134, 135, 162, 189, 216, 243, 270, 324, 351, 378, 405, 486, 513, 540, 567, 594, 621, 648, 702, 729, 783, 810, 891, 999, 1027, 1054, 1081, 1135, 1162, 1189, 1216, 1242, 1243, 1270, 1297, 1324, 1351, 1378, 1432, 1459, 1486, 1513, 1540, 1567, 1621, 1648, 1675, 1729, 1756, 1810, 1837, 1972 ], "cnt": 57 }
+{ "ids": [ 29, 55, 56, 244, 245, 272, 433, 461, 488, 542, 677, 812, 866, 893, 1001, 1029, 1245, 1353, 1434, 1461, 1488, 1623, 1650, 1677, 1758, 1812, 1893, 1975 ], "cnt": 28 }
+{ "ids": [ 31, 491, 1761, 1788 ], "cnt": 4 }
+{ "ids": [ 36, 62, 143, 225, 251, 252, 306, 441, 495, 522, 630, 711, 792, 793, 819, 900, 981, 1089, 1090, 1252, 1359, 1360, 1468, 1522, 1549, 1630, 1657, 1711, 1738, 1819, 1874, 1927 ], "cnt": 32 }
+{ "ids": [ 38, 91, 146, 172, 200, 308, 334, 362, 470, 551, 659, 713, 821, 1119, 1173, 1227, 1281, 1389, 1443, 1605, 1633, 1687, 1713, 1741, 1794, 1875 ], "cnt": 26 }
+{ "ids": [ 40, 41, 67, 94, 95, 149, 176, 203, 230, 257, 283, 311, 365, 392, 419, 446, 447, 473, 500, 527, 554, 581, 608, 635, 662, 689, 717, 743, 770, 797, 824, 851, 852, 905, 932, 959, 986, 1014, 1040, 1068, 1122, 1149, 1176, 1203, 1230, 1256, 1257, 1311, 1338, 1365, 1391, 1392, 1419, 1420, 1446, 1473, 1500, 1527, 1554, 1581, 1608, 1635, 1662, 1716, 1717, 1743, 1770, 1797, 1824, 1851, 1878, 1905, 1932, 1959, 1986, 1987 ], "cnt": 76 }
+{ "ids": [ 42, 68, 122, 312, 339, 366, 393, 420, 609, 636, 690, 744, 771, 798, 825, 987, 1015, 1041, 1095, 1123, 1177, 1204, 1312, 1339, 1366, 1393, 1663, 1690, 1744, 1745, 1771, 1798, 1907, 1960, 1961, 1988 ], "cnt": 36 }
+{ "ids": [ 46, 100, 154, 181, 235, 289, 343, 397, 424, 425, 478, 560, 614, 749, 803, 857, 938, 992, 1046, 1127, 1128, 1181, 1235, 1262, 1289, 1316, 1317, 1342, 1695, 1749, 1830, 1884, 1910, 1938 ], "cnt": 34 }
+{ "ids": [ 47, 236, 453, 480, 507, 534, 561, 615, 642, 669, 696, 750, 777, 804, 939, 993, 1047, 1075, 1102, 1129, 1182, 1183, 1210, 1237, 1264, 1318, 1345, 1372, 1399, 1453, 1480, 1507, 1561, 1562, 1588, 1615, 1642, 1696, 1723, 1750, 1804, 1858, 1939, 1993 ], "cnt": 44 }
+{ "ids": [ 50, 105, 131, 240, 348, 483, 537, 564, 618, 699, 753, 834, 862, 916, 969, 1050, 1051, 1105, 1131, 1132, 1186, 1240, 1321, 1347, 1349, 1375, 1456, 1484, 1618, 1619, 1699, 1753, 1834, 1862, 1915, 1969 ], "cnt": 36 }
+{ "ids": [ 51, 132, 186, 267, 321, 402, 456, 484, 565, 619, 700, 754, 780, 835, 889, 915, 970, 1024, 1159, 1213, 1267, 1348, 1402, 1403, 1483, 1537, 1672, 1700, 1754, 1781, 1835, 1889, 1916, 1917, 1970 ], "cnt": 35 }
+{ "ids": [ 64, 92, 118, 173, 254, 280, 335, 416, 605, 686, 766, 848, 875, 956, 984, 1010, 1037, 1065, 1118, 1334, 1335, 1416, 1523, 1550, 1578, 1659, 1686, 1821, 1902 ], "cnt": 29 }
+{ "ids": [ 66, 93, 336, 444, 687, 714, 1012, 1282, 1552, 1606 ], "cnt": 10 }
+{ "ids": [ 72, 126, 153, 206, 207, 423, 477, 531, 558, 612, 694, 828, 909, 1044, 1099, 1314, 1450, 1531, 1585, 1612, 1882, 1936 ], "cnt": 22 }
+{ "ids": [ 75, 102, 129, 157, 210, 237, 264, 292, 345, 372, 399, 427, 562, 670, 697, 805, 832, 940, 967, 1265, 1400, 1535, 1670, 1778, 1805, 1913, 1940 ], "cnt": 27 }
+{ "ids": [ 82, 297, 406, 432, 487, 541, 676, 784, 811, 865, 919, 1000, 1108, 1244, 1379, 1406, 1433, 1541, 1568, 1595, 1676, 1704, 1730, 1839, 1865, 1919, 1974, 2000 ], "cnt": 28 }
+{ "ids": [ 84, 112, 192, 274, 381, 463, 571, 652, 760, 814, 841, 868, 949, 976, 1003, 1031, 1058, 1139, 1192, 1220, 1382, 1408, 1436, 1491, 1516, 1517, 1571, 1760, 1814, 1841, 1868, 1949, 1950, 1976 ], "cnt": 34 }
+{ "ids": [ 85, 139, 166, 193, 220, 247, 301, 328, 382, 383, 437, 653, 706, 707, 761, 815, 869, 1004, 1112, 1166, 1221, 1274, 1328, 1329, 1490, 1544, 1896, 1922 ], "cnt": 28 }
+{ "ids": [ 88, 169, 222, 223, 249, 250, 276, 277, 331, 358, 385, 412, 439, 466, 493, 520, 547, 574, 628, 655, 682, 709, 710, 736, 790, 817, 844, 871, 898, 899, 953, 980, 1007, 1033, 1061, 1087, 1196, 1249, 1250, 1277, 1304, 1331, 1358, 1412, 1439, 1466, 1493, 1520, 1574, 1601, 1628, 1654, 1655, 1682, 1709, 1736, 1763, 1790, 1817, 1844, 1898, 1926, 1980 ], "cnt": 63 }
+{ "ids": [ 90, 144, 279, 442, 550, 739, 955, 1144, 1198, 1361, 1712, 1820 ], "cnt": 12 }
+{ "ids": [ 96, 123, 231, 258, 285, 501, 582, 799, 879, 933, 1150, 1447, 1501, 1528, 1609, 1636, 1825, 1853 ], "cnt": 18 }
+{ "ids": [ 98, 152, 179, 234, 287, 369, 395, 450, 585, 855, 882, 937, 963, 990, 1017, 1071, 1072, 1153, 1287, 1395, 1558, 1639, 1666, 1774, 1828, 1855, 1963, 1990 ], "cnt": 28 }
+{ "ids": [ 99, 125, 315, 341, 368, 504, 693, 720, 747, 908, 936, 1098, 1125, 1152, 1207, 1288, 1476, 1504, 1693, 1720, 1775, 1801 ], "cnt": 22 }
+{ "ids": [ 103, 104, 238, 239, 428, 455, 482, 563, 590, 671, 698, 806, 833, 941, 995, 1076, 1130, 1239, 1266, 1293, 1320, 1401, 1428, 1536, 1644, 1752, 1779, 1833, 1887, 1914, 1968, 1996 ], "cnt": 32 }
+{ "ids": [ 106, 107, 133, 241, 242, 268, 350, 376, 377, 458, 485, 511, 646, 647, 701, 782, 836, 917, 918, 1133, 1214, 1215, 1350, 1485, 1566, 1593, 1701, 1755, 1863, 1890 ], "cnt": 30 }
+{ "ids": [ 136, 217, 271, 298, 325, 352, 434, 460, 514, 704, 839, 920, 1028, 1055, 1082 ], "cnt": 15 }
+{ "ids": [ 145, 199, 361, 388, 469, 496, 497, 577, 767, 847, 874, 929, 1171, 1253, 1415, 1442, 1497, 1631, 1658, 1739, 1767, 1928, 1983 ], "cnt": 23 }
+{ "ids": [ 163, 190, 379, 380, 515, 569, 650, 758, 785, 813, 947, 948, 974, 1002, 1109, 1137, 1326, 1352, 1407, 1515, 1542, 1785, 1894, 1920 ], "cnt": 24 }
+{ "ids": [ 174, 499, 580, 742, 796, 1067, 1094, 1445, 1607, 1688, 1850 ], "cnt": 11 }
+{ "ids": [ 202, 229, 363, 445, 526, 688, 931, 985, 1013, 1039, 1147, 1310, 1337, 1553, 1634, 1796, 1904 ], "cnt": 17 }
+{ "ids": [ 215, 296, 431, 512, 593, 945, 1026, 1080, 1161, 1323, 1458, 1539, 1594, 1620, 1891 ], "cnt": 15 }
+{ "ids": [ 221, 517, 545, 572, 734, 896, 1085, 1140, 1247, 1302, 1464, 1626, 1653, 1815, 1977 ], "cnt": 15 }
+{ "ids": [ 256, 337, 715, 1283, 1364, 1742 ], "cnt": 6 }
+{ "ids": [ 261, 288, 370, 396, 532, 640, 666, 667, 774, 775, 802, 829, 856, 964, 991, 1018, 1126, 1234, 1261, 1315, 1369, 1370, 1396, 1423, 1477, 1505, 1532, 1640, 1667, 1694, 1747, 1802, 1829, 1856, 1937, 1964, 1991 ], "cnt": 37 }
+{ "ids": [ 302, 329, 464, 950, 977, 1193, 1518, 1545, 1572, 1625, 1680, 1734 ], "cnt": 12 }
+{ "ids": [ 503 ], "cnt": 1 }
+{ "ids": [ 568, 649, 703, 838, 946, 973, 1136, 1271, 1703, 1757, 1838, 1892, 1946, 1973 ], "cnt": 14 }
+{ "ids": [ 755, 1052, 1187, 1322, 1457, 1592, 1727, 1998 ], "cnt": 8 }
+{ "ids": [ 1697, 1832, 1967 ], "cnt": 3 }
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppClusterByVisitor.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppClusterByVisitor.java
index 10c194e58a..a6422d5ecc 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppClusterByVisitor.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppClusterByVisitor.java
@@ -133,15 +133,18 @@ public class SqlppClusterByVisitor extends AbstractSqlppSimpleExpressionVisitor
     private static final String OPT_CROSS_POLLINATION_RATIO = "cross_pollination_distance_ratio";
     private static final String OPT_INIT_MODE = "init_mode";
     private static final String OPT_DIMENSION = "dimension";
+    // K-Means only: pins every randomized choice in the initialization so a query reproduces. Guarded on the
+    // algorithm, because what it seeds is specific to this initialization -- a new one must re-admit it.
+    private static final String OPT_SEED = "seed";
 
     // cross_pollination_distance_ratio is deliberately NOT here: it was accepted but never read, so any value
     // -- negative, non-numeric -- passed silently. It comes back when cross-pollination itself does.
     private static final Set<String> KNOWN_OPTIONS = Set.of(OPT_ALGORITHM, OPT_NUM_CLUSTERS, OPT_SIMILARITY,
-            OPT_CROSS_POLLINATION, OPT_INIT_MODE, OPT_DIMENSION);
+            OPT_CROSS_POLLINATION, OPT_INIT_MODE, OPT_DIMENSION, OPT_SEED);
     // What an unknown-option error lists back to the user. Not printed from KNOWN_OPTIONS: Set.of iterates in
     // a per-JVM salted order, so the message would differ between runs.
     private static final String KNOWN_OPTIONS_DISPLAY =
-            "clustering_algorithm, num_clusters, dimension, similarity, cross_pollination, init_mode";
+            "clustering_algorithm, num_clusters, dimension, similarity, cross_pollination, init_mode, seed";
     // The fields the cluster descriptor exposes. Every one is substituted away during the rewrite, so a
     // surviving reference to the descriptor means the query asked for something else -- see checkDescriptorFields.
     private static final String SC_CLUSTER_ID = "cluster_id";
@@ -172,14 +175,12 @@ public class SqlppClusterByVisitor extends AbstractSqlppSimpleExpressionVisitor
     private static final String INIT_MODE_RANDOM = "random";
     private static final Set<String> KNOWN_INIT_MODES =
             Set.of(INIT_MODE_KMEANS_PARALLEL, INIT_MODE_KMEANSPP_DEPRECATED, INIT_MODE_RANDOM);
-    // Base for the per-round sampling seed (seed_r = EXACT_SEED_BASE + r). Holding it fixed makes a run
-    // reproducible on a fixed topology; the descriptor mixes in the partition id.
-    //
-    // The value is the smallest prime above one million, chosen for the same reason the descriptor multiplies
-    // by it: a prime stride keeps (base + round) * prime + partition from colliding across neighbouring
-    // (round, partition) pairs, so adjacent partitions do not start from correlated generator states. Nothing
-    // depends on the magnitude -- any prime of this size would do.
+    // The oversampling draw seed when the query supplies none. A draw hashes (vector fingerprint, seed,
+    // round) through mix64 (see KMeansLoopIO.uniformDraw), so any fixed value works equally well; this one
+    // stays because every existing test suite result was generated under it.
     private static final int EXACT_SEED_BASE = 1_000_003;
+    // RECLUSTER's roulette seed when the query supplies none. The value carries no meaning.
+    private static final int RECLUSTER_SEED_DEFAULT = 12345;
 
     // Lloyd iterations, passed to the loop operator as an argument.
     private static final int LLOYD_ITERATIONS = 3;
@@ -392,7 +393,7 @@ public class SqlppClusterByVisitor extends AbstractSqlppSimpleExpressionVisitor
             LimitClause limitKInit = new LimitClause(intLit(k, loc), null);
             limitKInit.setSourceLocation(loc);
             return selectValueFrom(copy(vecsQuery), rv0, rv0, null, usableVectorGuard(rv0, dimension, loc),
-                    ascOrder(uniformRowKey(rv0, loc)), null, limitKInit, loc);
+                    ascOrder(uniformRowKey(rv0, loc, seedOption(cbc))), null, limitKInit, loc);
         }
         // The oversampling loop runs INIT_OVERSAMPLING_ROUNDS rounds internally, then weighs the vectors
         // against the final pool into the (count, sum) partials RECLUSTER reduces. The innermost pool is the
@@ -400,17 +401,20 @@ public class SqlppClusterByVisitor extends AbstractSqlppSimpleExpressionVisitor
         // which would be a geometric extreme and bias every round measured from it.
         // Guarded: a rejected LIMIT 1 seed empties the pool outright -- and a row with no vector field makes
         // random(pv[0]) unknown, which orders FIRST, so the bad row was always the one drawn.
+        Integer seed = seedOption(cbc);
         VariableExpr pv = newVar(loc);
         LimitClause seedLimit = new LimitClause(intLit(1, loc), null);
         seedLimit.setSourceLocation(loc);
         Expression poolStream = selectValueFrom(copy(vecsQuery), pv, pv, null, usableVectorGuard(pv, dimension, loc),
-                ascOrder(uniformRowKey(pv, loc)), null, seedLimit, loc);
+                ascOrder(uniformRowKey(pv, loc, seed)), null, seedLimit, loc);
+        int drawSeed = seed == null ? EXACT_SEED_BASE : seed;
         Expression weighed = call(BuiltinFunctions.KMEANS_OVERSAMPLE_LOOP, loc, copy(vecsQuery), poolStream,
-                intLit(oversamplingFactor(k, loc), loc), intLit(INIT_OVERSAMPLING_ROUNDS, loc),
-                intLit(EXACT_SEED_BASE, loc), intLit(dimension, loc));
+                intLit(oversamplingFactor(k, loc), loc), intLit(INIT_OVERSAMPLING_ROUNDS, loc), intLit(drawSeed, loc),
+                intLit(dimension, loc));
         // RECLUSTER: single-input merge of the (broadcast) partials -- reduces the weighted candidates to at
         // most k initial centres with weighted k-means++.
-        return call(BuiltinFunctions.KMEANS_RECLUSTER, loc, weighed, intLit(k, loc));
+        return call(BuiltinFunctions.KMEANS_RECLUSTER, loc, weighed, intLit(k, loc),
+                intLit(seed == null ? RECLUSTER_SEED_DEFAULT : seed, loc));
     }
 
     /**
@@ -651,8 +655,13 @@ public class SqlppClusterByVisitor extends AbstractSqlppSimpleExpressionVisitor
      * The key costs nothing: {@code ORDER BY ... LIMIT n} still compiles to a streaming top-n that holds n
      * rows, and ranking one double is cheaper than ranking a vector element by element.
      */
-    private Expression uniformRowKey(VariableExpr rowVar, SourceLocation loc) {
-        return call(BuiltinFunctions.RANDOM_WITH_SEED, loc, elementAt(varRef(rowVar.getVar(), loc), 0, loc));
+    private Expression uniformRowKey(VariableExpr rowVar, SourceLocation loc, Integer seed) {
+        Expression rowSeed = elementAt(varRef(rowVar.getVar(), loc), 0, loc);
+        if (seed != null) {
+            // The offset does not make the key a pure function of the row -- see random(x) above.
+            rowSeed = binaryOp(OperatorType.PLUS, rowSeed, intLit(seed, loc), loc);
+        }
+        return call(BuiltinFunctions.RANDOM_WITH_SEED, loc, rowSeed);
     }
 
     /** {@code <left> <op> <right>} as an OperatorExpr. */
@@ -773,6 +782,21 @@ public class SqlppClusterByVisitor extends AbstractSqlppSimpleExpressionVisitor
             throw new CompilationException(ErrorCode.COMPILATION_ERROR, cbc.getSourceLocation(),
                     "Unsupported CLUSTER BY 'clustering_algorithm' '" + algorithm + "'. Supported: K-Means.");
         }
+        // 'seed' is K-Means specific. Below the algorithm check, so an unsupported algorithm is reported as
+        // one; against getAlgorithm(), so both spellings pass. A new algorithm must re-admit the option.
+        String seed = opts.get(OPT_SEED);
+        if (seed != null) {
+            if (!ALGORITHM_KMEANS.equals(getAlgorithm(cbc))) {
+                throw new CompilationException(ErrorCode.COMPILATION_ERROR, cbc.getSourceLocation(),
+                        "CLUSTER BY 'seed' applies to K-Means only.");
+            }
+            try {
+                Integer.parseInt(seed.trim());
+            } catch (NumberFormatException e) {
+                throw new CompilationException(ErrorCode.COMPILATION_ERROR, cbc.getSourceLocation(),
+                        "CLUSTER BY 'seed' must be a 32-bit integer, but was: " + seed);
+            }
+        }
         // init_mode is optional but, if present, must be recognized.
         String initMode = opts.get(OPT_INIT_MODE);
         if (initMode != null && !KNOWN_INIT_MODES.contains(initMode.toLowerCase())) {
@@ -785,13 +809,13 @@ public class SqlppClusterByVisitor extends AbstractSqlppSimpleExpressionVisitor
     }
 
     /**
-     * The validated clustering algorithm, defaulting to k-means. Resolved rather than merely validated because
-     * {@code Dimension}'s contract belongs to the algorithm: k-means needs one fixed vector width, and a future
-     * algorithm without fixed-width vectors must be able to state its own rule instead of inheriting this one.
+     * Both accepted spellings of k-means, and an absent option, yield {@link #ALGORITHM_KMEANS}; any other value
+     * yields itself, lowercased.
      */
     private String getAlgorithm(ClusterbyClause cbc) throws CompilationException {
         String algorithm = scalarOptions(cbc).get(OPT_ALGORITHM);
-        return algorithm == null ? ALGORITHM_KMEANS : algorithm.toLowerCase();
+        String lower = algorithm == null ? ALGORITHM_KMEANS : algorithm.toLowerCase();
+        return KNOWN_ALGORITHMS.contains(lower) ? ALGORITHM_KMEANS : lower;
     }
 
     /**
@@ -855,6 +879,16 @@ public class SqlppClusterByVisitor extends AbstractSqlppSimpleExpressionVisitor
         }
     }
 
+    /**
+     * The query's {@code seed}, or null when absent -- each caller turns null into its own built-in constant.
+     * Parses uncaught on purpose: {@link #validateWithOptionsAndGetK} has already rejected a non-int, so a
+     * failure here is a broken invariant and should surface as one.
+     */
+    private Integer seedOption(ClusterbyClause cbc) throws CompilationException {
+        String raw = scalarOptions(cbc).get(OPT_SEED);
+        return raw == null ? null : Integer.valueOf(raw.trim());
+    }
+
     /** The validated init_mode, canonicalised ({@link #INIT_MODE_KMEANS_PARALLEL} default). */
     private String getInitMode(ClusterbyClause cbc) throws CompilationException {
         String mode = scalarOptions(cbc).get(OPT_INIT_MODE);
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
index ee7cddc50e..295f6e3e65 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
@@ -1242,21 +1242,9 @@ public class BuiltinFunctions {
             FunctionConstants.newAsterix("ann-distance", FunctionIdentifier.VARARGS);
     // CLUSTER BY: nearest_centroid(point, centroids) -> AINT32 index of the closest centroid.
     public static final FunctionIdentifier NEAREST_CENTROID = FunctionConstants.newAsterix("nearest-centroid", 2);
-    // kmeans-recluster(partials, k): single-input merge — reduce partials, then weighted k-means++ to k (C0).
-    public static final FunctionIdentifier KMEANS_RECLUSTER = FunctionConstants.newAsterix("kmeans-recluster", 2);
-    // CLUSTER BY initMode "kmeansPP": the exact k-means|| oversampling init as one self-iterating
-    // operator. kmeans-oversample-loop(vectors, seedPool, l, rounds, seedBase, dimension): runs the whole
-    // oversample loop internally, iterating `rounds` times and all-reducing the per-round global potential +
-    // draws across partitions; the physical operator realizes it as an injected pipelined systolic sub-graph.
-    // The final pool is weighed and emitted for kmeans-recluster. `dimension` is the declared vector width,
-    // enforced by the operator's decoder.
+    public static final FunctionIdentifier KMEANS_RECLUSTER = FunctionConstants.newAsterix("kmeans-recluster", 3);
     public static final FunctionIdentifier KMEANS_OVERSAMPLE_LOOP =
             FunctionConstants.newAsterix("kmeans-oversample-loop", 6);
-
-    // The Lloyd refinement as one self-iterating operator. kmeans-lloyd-loop(vectors, centroids, k,
-    // iterations, dimension): runs every refinement iteration internally, all-reducing each iteration's
-    // per-centroid (count, sum) partials into the next centroid set; the physical operator realizes it as an
-    // injected pipelined systolic sub-graph. Emits the final centroid set as plain vectors.
     public static final FunctionIdentifier KMEANS_LLOYD_LOOP = FunctionConstants.newAsterix("kmeans-lloyd-loop", 5);
 
     // Temporal functions
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/kmeans/KMeansReclusterOperatorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/kmeans/KMeansReclusterOperatorDescriptor.java
index 4801bd1ef9..65ff9ffa78 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/kmeans/KMeansReclusterOperatorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/kmeans/KMeansReclusterOperatorDescriptor.java
@@ -63,14 +63,10 @@ public final class KMeansReclusterOperatorDescriptor extends AbstractOperatorDes
     private static final int STORE_POOL_ACTIVITY_ID = 0;
     private static final int SCORE_ACTIVITY_ID = 1;
 
-    // Seed for RECLUSTER's weighted k-means++ draw. The selection is randomized by nature, but CLUSTER BY
-    // promises that the same query over the same data returns the same clusters, so the draw must not vary
-    // between runs. A constant seed gives that: RECLUSTER runs on a single partition over one already-merged
-    // pool, so one generator sequence covers the whole decision. The value itself carries no meaning, with one
-    // constraint -- Random's constructor XORs the seed against its own multiplier (0x5DEECE66D), so that value
-    // would zero the initial state and make the first draw 0.0, which turns the first centre into a fixed
-    // choice of the lowest-indexed candidate rather than a weighted one.
-    private static final long RECLUSTER_SEED = 12345L;
+    // Seed for the weighted k-means++ draw, supplied by the plan. One seed covers the whole decision: this stage
+    // runs on a single partition over one already-merged pool. It does not on its own make the pick
+    // reproducible -- the draw walks a prefix sum in array order, so the pool's ORDER decides too.
+    private final long reclusterSeed;
 
     // How many centroids to keep. Non-negative.
     private final int count;
@@ -80,9 +76,10 @@ public final class KMeansReclusterOperatorDescriptor extends AbstractOperatorDes
     private final int framesLimit;
 
     public KMeansReclusterOperatorDescriptor(IOperatorDescriptorRegistry spec, RecordDescriptor vectorRecDesc,
-            int count, int poolColumn, int framesLimit) {
+            int count, int poolColumn, int framesLimit, long reclusterSeed) {
         // One input: the broadcast partials, which are always envelope rows (the oversampling loop's output).
         super(spec, 1, 1);
+        this.reclusterSeed = reclusterSeed;
         this.framesLimit = framesLimit;
         this.count = count;
         this.poolColumn = poolColumn;
@@ -166,7 +163,7 @@ public final class KMeansReclusterOperatorDescriptor extends AbstractOperatorDes
         final double[] nearest = new double[n]; // d^2 to the closest already-chosen centre
         Arrays.fill(nearest, Double.POSITIVE_INFINITY);
         final boolean[] taken = new boolean[n];
-        final Random rng = new Random(RECLUSTER_SEED);
+        final Random rng = new Random(reclusterSeed);
         final double[] score = new double[n];
         final int target = Math.min(count, n);
         int chosen = 0;
diff --git a/asterixdb/asterix-runtime/src/test/java/org/apache/asterix/runtime/operators/kmeans/KMeansReclusterOperatorTest.java b/asterixdb/asterix-runtime/src/test/java/org/apache/asterix/runtime/operators/kmeans/KMeansReclusterOperatorTest.java
index 75b8580dcc..d2dce3a2c3 100644
--- a/asterixdb/asterix-runtime/src/test/java/org/apache/asterix/runtime/operators/kmeans/KMeansReclusterOperatorTest.java
+++ b/asterixdb/asterix-runtime/src/test/java/org/apache/asterix/runtime/operators/kmeans/KMeansReclusterOperatorTest.java
@@ -66,6 +66,9 @@ import org.junit.Test;
  */
 @AiProvenance(agent = AiProvenance.Agent.CLAUDE_OPUS_4_8, tool = AiProvenance.Tool.CLAUDE_CODE_UI, contributionKind = AiProvenance.ContributionKind.ASSISTED)
 public class KMeansReclusterOperatorTest {
+    // Same value as SqlppClusterByVisitor's RECLUSTER_SEED_DEFAULT, the seed used when a query sets none
+    // (mirrored here: this module cannot see that class). The expected picks below depend on it.
+    private static final long DEFAULT_RECLUSTER_SEED = 12345L;
 
     /** Enough frames for the partial sort to run in memory in this fixture. */
     private static final int TEST_FRAMES_LIMIT = 32;
@@ -108,8 +111,8 @@ public class KMeansReclusterOperatorTest {
     private static List<double[]> runRecluster(int k) throws Exception {
         IHyracksTaskContext ctx = TestUtils.create(32768);
         JobSpecification spec = new JobSpecification();
-        KMeansReclusterOperatorDescriptor op =
-                new KMeansReclusterOperatorDescriptor(spec, VEC_REC_DESC, k, 0, TEST_FRAMES_LIMIT);
+        KMeansReclusterOperatorDescriptor op = new KMeansReclusterOperatorDescriptor(spec, VEC_REC_DESC, k, 0,
+                TEST_FRAMES_LIMIT, DEFAULT_RECLUSTER_SEED);
 
         // Single-input merge — activities: StorePool (0), Score (1). No vector input.
         List<IActivity> activities = collectActivities(op);
@@ -286,7 +289,7 @@ public class KMeansReclusterOperatorTest {
         IHyracksTaskContext ctx = TestUtils.create(32768);
         JobSpecification spec = new JobSpecification();
         KMeansReclusterOperatorDescriptor op =
-                new KMeansReclusterOperatorDescriptor(spec, VEC_REC_DESC, 8, 0, framesLimit);
+                new KMeansReclusterOperatorDescriptor(spec, VEC_REC_DESC, 8, 0, framesLimit, DEFAULT_RECLUSTER_SEED);
         List<IActivity> activities = collectActivities(op);
         IRecordDescriptorProvider rdp = recordDescProvider();
         IOperatorNodePushable poolStore = activities.get(0).createPushRuntime(ctx, rdp, 0, 1);
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/IsomorphismOperatorVisitor.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/IsomorphismOperatorVisitor.java
index 8cd6cac482..57ab81c3e4 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/IsomorphismOperatorVisitor.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/IsomorphismOperatorVisitor.java
@@ -404,7 +404,11 @@ public class IsomorphismOperatorVisitor implements ILogicalOperatorVisitor<Boole
         }
         KMeansStageOperator other = (KMeansStageOperator) aop;
         // vectorVariable is null for the single-input merge modes (RECLUSTER/LLOYD).
+        // The seed, round count and vector width are part of the stage's properties, so equality
+        // compares them too.
         return op.getTopCount() == other.getTopCount() && op.getMode() == other.getMode()
+                && op.getSeed() == other.getSeed() && op.getLoopRounds() == other.getLoopRounds()
+                && op.getDimension() == other.getDimension()
                 && java.util.Objects.equals(op.getVectorVariable(), other.getVectorVariable())
                 && op.getPoolVariable().equals(other.getPoolVariable())
                 && op.getCandidateVariable().equals(other.getCandidateVariable());
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitor.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitor.java
index e31153ae40..eb4ed30269 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitor.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitor.java
@@ -368,11 +368,13 @@ public class LogicalOperatorPrettyPrintVisitor extends AbstractLogicalOperatorPr
         switch (op.getMode()) {
             case RECLUSTER:
                 out.append(" pool ").append(str(op.getPoolVariable())).append(" to ")
-                        .append(String.valueOf(op.getTopCount())).append(" means");
+                        .append(String.valueOf(op.getTopCount())).append(" means (seed ")
+                        .append(String.valueOf(op.getSeed())).append(')');
                 break;
             case OVERSAMPLE_LOOP:
                 out.append(' ').append(String.valueOf(op.getLoopRounds())).append(" rounds of ")
-                        .append(str(op.getVectorVariable())).append(" vs seed ").append(str(op.getPoolVariable()));
+                        .append(str(op.getVectorVariable())).append(" vs seed ").append(str(op.getPoolVariable()))
+                        .append(" (seed ").append(String.valueOf(op.getSeed())).append(')');
                 break;
             default:
                 out.append(' ').append(str(op.getVectorVariable())).append(" vs pool ")
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitorJson.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitorJson.java
index 23bf8c3033..967b6da950 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitorJson.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/prettyprint/LogicalOperatorPrettyPrintVisitorJson.java
@@ -877,6 +877,7 @@ public class LogicalOperatorPrettyPrintVisitorJson extends AbstractLogicalOperat
             jsonGenerator.writeStringField("pool-variable", String.valueOf(op.getPoolVariable()));
             jsonGenerator.writeNumberField("top-count", op.getTopCount());
             jsonGenerator.writeStringField("mode", op.getMode().getLabel());
+            jsonGenerator.writeNumberField("seed", op.getSeed());
             return null;
         } catch (IOException e) {
             throw AlgebricksException.create(ErrorCode.ERROR_PRINTING_PLAN, e, String.valueOf(e));
diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/utils/LogicalOperatorDotVisitor.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/utils/LogicalOperatorDotVisitor.java
index 9016098e49..3fed22f10b 100644
--- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/utils/LogicalOperatorDotVisitor.java
+++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/utils/LogicalOperatorDotVisitor.java
@@ -354,11 +354,12 @@ public class LogicalOperatorDotVisitor implements ILogicalOperatorVisitor<String
         switch (op.getMode()) {
             case RECLUSTER:
                 stringBuilder.append(" pool ").append(str(op.getPoolVariable())).append(" to ").append(op.getTopCount())
-                        .append(" means");
+                        .append(" means (seed ").append(op.getSeed()).append(')');
                 break;
             case OVERSAMPLE_LOOP:
                 stringBuilder.append(' ').append(op.getLoopRounds()).append(" rounds of ")
-                        .append(str(op.getVectorVariable())).append(" vs seed ").append(str(op.getPoolVariable()));
+                        .append(str(op.getVectorVariable())).append(" vs seed ").append(str(op.getPoolVariable()))
+                        .append(" (seed ").append(op.getSeed()).append(')');
                 break;
             default:
                 stringBuilder.append(' ').append(str(op.getVectorVariable())).append(" vs pool ")