[XL] Change in asterixdb[master]: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop

2026-10-05 Thread AsterixDB Code Review
>From Shahrzad Shirazi :

Shahrzad Shirazi has posted comments on this change by Shahrzad Shirazi. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email )

Change subject: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop
..


Patch Set 3: Verified+1


--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: Iddc985b91e7f3cfb043a29f6ad48e6e4f39b2fe2
Gerrit-Change-Number: 21984
Gerrit-PatchSet: 3
Gerrit-Owner: Shahrzad Shirazi 
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Hongyu Shi 
Gerrit-Reviewer: Jenkins 
Gerrit-Reviewer: Shahrzad Shirazi 
Gerrit-Comment-Date: Mon, 05 Oct 2026 18:20:27 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes


[XL] Change in asterixdb[master]: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop

2026-10-05 Thread AsterixDB Code Review
>From Shahrzad Shirazi :

Shahrzad Shirazi has submitted this change. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email )

Change subject: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop
..

[NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
CLUSTER BY labelled its rows with a join: the final centroids
were sorted, listified and broadcast, then nested-loop joined
onto a materialized copy of every input row and placed with
nearest-centroid. That copy was the largest temporary file of
the query, and the join is what required it.

The loop that stores the rows now keeps the columns the
clusters are built from beside each vector, position-aligned,
and the Lloyd loop labels every row itself after its last
iteration: the position of the nearest centroid in the final
set ordered by value, ties to the first, as before. The
labelling join, the centroid listify, nearest-centroid and the
materialized replicate output are removed. Results are
unchanged; the input is written to disk once.

- KMeansStageOperator: row variables (typed on the operator)
  and an optional assignment-centroid variable; LLOYD_LOOP
  emits them with the cluster id.
- Payload column beside the vector run file, handed from the
  oversampling loop to the Lloyd loop with the vectors; the
  Lloyd loop's drained input carries only the vector.
- KMEANS_STAGE and CLUSTER_BY are filter-pushdown scopes.
- Variable substitution updates the stage's type environment.
- A row with no finite distance to any centroid warns.
- nearest-centroid is removed; nothing uses it.
- Expected plans for cluster-by regenerated.

Ext-ref: MB-74142
Generated-by: Claude Opus 5.5 
Change-Id: Iddc985b91e7f3cfb043a29f6ad48e6e4f39b2fe2
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984
Tested-by: Shahrzad Shirazi 
Integration-Tests: Jenkins 
Reviewed-by: Hongyu Shi 
---
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/AbstractKMeansLoopPOperator.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/AbstractKMeansStagePOperator.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/KMeansLloydLoopPOperator.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/KMeansOversampleLoopPOperator.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/AsterixInlineVariablesRule.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RewriteClusterByToKMeansRule.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/PushdownContext.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
M 
asterixdb/asterix-app/src/test/resources/optimizerts/queries/cluster-by/kmeans-syntax-validate.sqlpp
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-decor-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-init-random-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-join-members-projected.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-limit-input-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-syntax-full-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-syntax-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-unnest-filtered-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-unnest-members-twice-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-unnest-members-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-unnest-positional-validate.plan
M 
asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-num-iterations/kmeans-num-iterations.10.plan
M 
asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-num-iterations/kmeans-num-iterations.11.plan
M 
asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-num-iterations/kmeans-num-iterations.12.plan
M 
asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-num-iterations/kmeans-num-iterations.8.plan
M 
asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-num-iterations/kmeans-num-iterations.9.plan
M 
asterixdb/asterix-app/src/test/resources/runtimets/results_cbo/cluster-by/kmeans-num-iterations/kmeans-num-iterations.10.plan
M 

[XL] Change in asterixdb[master]: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop

2026-10-05 Thread AsterixDB Code Review
>From Shahrzad Shirazi :

Attention is currently required from: Shahrzad Shirazi.

Shahrzad Shirazi has removed a vote from this change. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email )


Change subject: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop
..


Removed Verified-1 by Jenkins 
--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: deleteVote
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: Iddc985b91e7f3cfb043a29f6ad48e6e4f39b2fe2
Gerrit-Change-Number: 21984
Gerrit-PatchSet: 3
Gerrit-Owner: Shahrzad Shirazi 
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Hongyu Shi 
Gerrit-Reviewer: Jenkins 
Gerrit-Attention: Shahrzad Shirazi 


[XL] Change in asterixdb[master]: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop

2026-10-05 Thread AsterixDB Code Review
>From Hongyu Shi :

Attention is currently required from: Shahrzad Shirazi.

Hongyu Shi has posted comments on this change by Shahrzad Shirazi. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email )

Change subject: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop
..


Patch Set 3: Code-Review+2


--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: Iddc985b91e7f3cfb043a29f6ad48e6e4f39b2fe2
Gerrit-Change-Number: 21984
Gerrit-PatchSet: 3
Gerrit-Owner: Shahrzad Shirazi 
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Hongyu Shi 
Gerrit-Reviewer: Jenkins 
Gerrit-Attention: Shahrzad Shirazi 
Gerrit-Comment-Date: Mon, 05 Oct 2026 18:17:54 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes


[XL] Change in asterixdb[master]: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop

2026-10-05 Thread AsterixDB Code Review
Attention is currently required from: Hongyu Shi, Shahrzad Shirazi.

Anon. E. Moose #1000171 has posted comments on this change by Shahrzad Shirazi. 
( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email )

Change subject: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop
..


Patch Set 3: Contrib-2

Analytics Compatibility Tests Failed
https://cbjenkins.page.link/VxFrhwZcnMM6a6ga8 : UNSTABLE


--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: Iddc985b91e7f3cfb043a29f6ad48e6e4f39b2fe2
Gerrit-Change-Number: 21984
Gerrit-PatchSet: 3
Gerrit-Owner: Shahrzad Shirazi 
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Hongyu Shi 
Gerrit-Reviewer: Jenkins 
Gerrit-Attention: Shahrzad Shirazi 
Gerrit-Attention: Hongyu Shi 
Gerrit-Comment-Date: Mon, 05 Oct 2026 08:23:07 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes


[XL] Change in asterixdb[master]: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop

2026-10-05 Thread AsterixDB Code Review
>From Jenkins :

Attention is currently required from: Hongyu Shi.

Jenkins has posted comments on this change by Shahrzad Shirazi. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email )

Change subject: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop
..


Patch Set 3: Integration-Tests+1

Integration Tests Successful

https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-trigger/8115/ : SUCCESS


--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: Iddc985b91e7f3cfb043a29f6ad48e6e4f39b2fe2
Gerrit-Change-Number: 21984
Gerrit-PatchSet: 3
Gerrit-Owner: Shahrzad Shirazi 
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Hongyu Shi 
Gerrit-Reviewer: Jenkins 
Gerrit-Attention: Hongyu Shi 
Gerrit-Comment-Date: Mon, 05 Oct 2026 08:08:18 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes


[XL] Change in asterixdb[master]: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop

2026-10-04 Thread AsterixDB Code Review
Attention is currently required from: Hongyu Shi.

Anon. E. Moose #1000171 has posted comments on this change by Shahrzad Shirazi. 
( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email )

Change subject: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop
..


Patch Set 3:

Analytics Compatibility Compilation Successful
https://cbjenkins.page.link/sKWGPr41vvraxojZ6 : SUCCESS


--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: Iddc985b91e7f3cfb043a29f6ad48e6e4f39b2fe2
Gerrit-Change-Number: 21984
Gerrit-PatchSet: 3
Gerrit-Owner: Shahrzad Shirazi 
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Hongyu Shi 
Gerrit-Reviewer: Jenkins 
Gerrit-Attention: Hongyu Shi 
Gerrit-Comment-Date: Mon, 05 Oct 2026 06:30:09 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No


[XL] Change in asterixdb[master]: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop

2026-10-04 Thread AsterixDB Code Review
>From Shahrzad Shirazi :

Attention is currently required from: Hongyu Shi, Shahrzad Shirazi.

Hello Anon. E. Moose #1000171, Hongyu Shi, Jenkins,

I'd like you to reexamine a change. Please visit

https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email

to look at the new patch set (#3).

The following approvals got outdated and were removed:
Contrib-2 by Anon. E. Moose #1000171


Change subject: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop
..

[NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
CLUSTER BY labelled its rows with a join: the final centroids
were sorted, listified and broadcast, then nested-loop joined
onto a materialized copy of every input row and placed with
nearest-centroid. That copy was the largest temporary file of
the query, and the join is what required it.

The loop that stores the rows now keeps the columns the
clusters are built from beside each vector, position-aligned,
and the Lloyd loop labels every row itself after its last
iteration: the position of the nearest centroid in the final
set ordered by value, ties to the first, as before. The
labelling join, the centroid listify, nearest-centroid and the
materialized replicate output are removed. Results are
unchanged; the input is written to disk once.

- KMeansStageOperator: row variables (typed on the operator)
  and an optional assignment-centroid variable; LLOYD_LOOP
  emits them with the cluster id.
- Payload column beside the vector run file, handed from the
  oversampling loop to the Lloyd loop with the vectors; the
  Lloyd loop's drained input carries only the vector.
- KMEANS_STAGE and CLUSTER_BY are filter-pushdown scopes.
- Variable substitution updates the stage's type environment.
- A row with no finite distance to any centroid warns.
- nearest-centroid is removed; nothing uses it.
- Expected plans for cluster-by regenerated.

Ext-ref: MB-74142
Generated-by: Claude Opus 5.5 
Change-Id: Iddc985b91e7f3cfb043a29f6ad48e6e4f39b2fe2
---
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/AbstractKMeansLoopPOperator.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/AbstractKMeansStagePOperator.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/KMeansLloydLoopPOperator.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/KMeansOversampleLoopPOperator.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/AsterixInlineVariablesRule.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RewriteClusterByToKMeansRule.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/PushdownContext.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
M 
asterixdb/asterix-app/src/test/resources/optimizerts/queries/cluster-by/kmeans-syntax-validate.sqlpp
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-decor-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-init-random-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-join-members-projected.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-limit-input-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-syntax-full-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-syntax-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-unnest-filtered-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-unnest-members-twice-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-unnest-members-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-unnest-positional-validate.plan
M 
asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-num-iterations/kmeans-num-iterations.10.plan
M 
asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-num-iterations/kmeans-num-iterations.11.plan
M 
asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-num-iterations/kmeans-num-iterations.12.plan
M 
asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-num-iterations/kmeans-num-iterations.8.plan
M 
asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-num-iterations/kmeans-num-iterations.9.plan
M 

[XL] Change in asterixdb[master]: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop

2026-10-04 Thread AsterixDB Code Review
Attention is currently required from: Hongyu Shi, Shahrzad Shirazi.

Anon. E. Moose #1000171 has posted comments on this change by Shahrzad Shirazi. 
( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email )

Change subject: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop
..


Patch Set 2: Contrib-2

Analytics Compatibility Compilation Failed
https://cbjenkins.page.link/CyBoevWpf2QH9Wf36 : UNSTABLE


--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: Iddc985b91e7f3cfb043a29f6ad48e6e4f39b2fe2
Gerrit-Change-Number: 21984
Gerrit-PatchSet: 2
Gerrit-Owner: Shahrzad Shirazi 
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Hongyu Shi 
Gerrit-Reviewer: Jenkins 
Gerrit-Attention: Shahrzad Shirazi 
Gerrit-Attention: Hongyu Shi 
Gerrit-Comment-Date: Mon, 05 Oct 2026 06:18:56 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes


[XL] Change in asterixdb[master]: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop

2026-10-02 Thread AsterixDB Code Review
>From Jenkins :

Attention is currently required from: Hongyu Shi, Shahrzad Shirazi.

Jenkins has posted comments on this change by Shahrzad Shirazi. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email )

Change subject: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop
..


Patch Set 1: Integration-Tests-1

Integration Tests Failed

https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-trigger/8085/ : UNSTABLE


--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: Iddc985b91e7f3cfb043a29f6ad48e6e4f39b2fe2
Gerrit-Change-Number: 21984
Gerrit-PatchSet: 1
Gerrit-Owner: Shahrzad Shirazi 
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Hongyu Shi 
Gerrit-Reviewer: Jenkins 
Gerrit-Attention: Shahrzad Shirazi 
Gerrit-Attention: Hongyu Shi 
Gerrit-Comment-Date: Sat, 03 Oct 2026 02:27:40 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes


[XL] Change in asterixdb[master]: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop

2026-10-02 Thread AsterixDB Code Review
Attention is currently required from: Hongyu Shi, Shahrzad Shirazi.

Anon. E. Moose #1000171 has posted comments on this change by Shahrzad Shirazi. 
( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email )

Change subject: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop
..


Patch Set 1: Contrib-2

Analytics Compatibility Tests Failed
https://cbjenkins.page.link/f219Rm6kR33L2PMX6 : UNSTABLE


--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: Iddc985b91e7f3cfb043a29f6ad48e6e4f39b2fe2
Gerrit-Change-Number: 21984
Gerrit-PatchSet: 1
Gerrit-Owner: Shahrzad Shirazi 
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Hongyu Shi 
Gerrit-CC: Jenkins 
Gerrit-Attention: Shahrzad Shirazi 
Gerrit-Attention: Hongyu Shi 
Gerrit-Comment-Date: Sat, 03 Oct 2026 01:31:38 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes


[XL] Change in asterixdb[master]: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop

2026-10-02 Thread AsterixDB Code Review
Anon. E. Moose #1000171 has posted comments on this change by Shahrzad Shirazi. 
( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email )

Change subject: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop
..


Patch Set 1:

Analytics Compatibility Compilation Successful
https://cbjenkins.page.link/aPASyxm9fELrfNZW9 : SUCCESS


--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: Iddc985b91e7f3cfb043a29f6ad48e6e4f39b2fe2
Gerrit-Change-Number: 21984
Gerrit-PatchSet: 1
Gerrit-Owner: Shahrzad Shirazi 
Gerrit-CC: Anon. E. Moose #1000171
Gerrit-Comment-Date: Fri, 02 Oct 2026 23:49:02 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No


[XL] Change in asterixdb[master]: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop

2026-10-02 Thread AsterixDB Code Review
>From Shahrzad Shirazi :

Shahrzad Shirazi has uploaded this change for review. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21984?usp=email )


Change subject: [NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop
..

[NO ISSUE][COMP][RT] CLUSTER BY: label rows in Lloyd loop

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
CLUSTER BY labelled its rows with a join: the final centroids
were sorted, listified and broadcast, then nested-loop joined
onto a materialized copy of every input row and placed with
nearest-centroid. That copy was the largest temporary file of
the query, and the join is what required it.

The loop that stores the rows now keeps the columns the
clusters are built from beside each vector, position-aligned,
and the Lloyd loop labels every row itself after its last
iteration: the position of the nearest centroid in the final
set ordered by value, ties to the first, as before. The
labelling join, the centroid listify, nearest-centroid and the
materialized replicate output are removed. Results are
unchanged; the input is written to disk once.

- KMeansStageOperator: row variables (typed on the operator)
  and an optional assignment-centroid variable; LLOYD_LOOP
  emits them with the cluster id.
- Payload column beside the vector run file, handed from the
  oversampling loop to the Lloyd loop with the vectors; the
  Lloyd loop's drained input carries only the vector.
- KMEANS_STAGE and CLUSTER_BY are filter-pushdown scopes.
- Variable substitution updates the stage's type environment.
- A row with no finite distance to any centroid warns.
- nearest-centroid is removed; nothing uses it.
- Expected plans for cluster-by regenerated.

Ext-ref: MB-74142
Generated-by: Claude Opus 5.5 
Change-Id: Iddc985b91e7f3cfb043a29f6ad48e6e4f39b2fe2
---
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/AbstractKMeansLoopPOperator.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/AbstractKMeansStagePOperator.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/KMeansLloydLoopPOperator.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/algebra/operators/physical/KMeansOversampleLoopPOperator.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/AsterixInlineVariablesRule.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/RewriteClusterByToKMeansRule.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/PushdownContext.java
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
M 
asterixdb/asterix-app/src/test/resources/optimizerts/queries/cluster-by/kmeans-syntax-validate.sqlpp
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-decor-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-init-random-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-join-members-projected.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-limit-input-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-syntax-full-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-syntax-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-unnest-filtered-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-unnest-members-twice-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-unnest-members-validate.plan
M 
asterixdb/asterix-app/src/test/resources/optimizerts/results/cluster-by/kmeans-unnest-positional-validate.plan
M 
asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-num-iterations/kmeans-num-iterations.10.plan
M 
asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-num-iterations/kmeans-num-iterations.11.plan
M 
asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-num-iterations/kmeans-num-iterations.12.plan
M 
asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-num-iterations/kmeans-num-iterations.8.plan
M 
asterixdb/asterix-app/src/test/resources/runtimets/results/cluster-by/kmeans-num-iterations/kmeans-num-iterations.9.plan
M 
asterixdb/asterix-app/src/test/resources/runtimets/results_cbo/cluster-by/kmeans-num-iterations/kmeans-num-iterations.10.plan
M 
asterixdb/asterix-app/src/test/resources/runtimets/results_cbo/cluster-by/kmeans-num-iterations/kmeans-num-iterations.11.plan
M