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

stariy95 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git


The following commit(s) were added to refs/heads/master by this push:
     new a6d00e450 CAY-3009 Column select with CLOB attribute and distinct() 
fails + CAY-2832 just reenable tests
a6d00e450 is described below

commit a6d00e450233350a04ab909edc444c97dea1e5cf
Author: ntimofeev <[email protected]>
AuthorDate: Fri Sep 4 16:38:11 2026 +0300

    CAY-3009 Column select with CLOB attribute and distinct() fails
    + CAY-2832 just reenable tests
---
 RELEASE-NOTES.txt                                  |  2 ++
 .../apache/cayenne/access/jdbc/SelectAction.java   |  5 ++--
 .../apache/cayenne/access/jdbc/SelectActionIT.java | 34 ++++++++++++++++++++--
 3 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index e3b4f8862..bfeba2da5 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -20,6 +20,7 @@ CAY-3007 Deprecate SelectById
 
 Bug Fixes:
 
+CAY-2832 SelectActionIT is failing on GitHub Actions
 CAY-2996 Javadocs are missing from the central artifacts
 CAY-2999 Modeler: A restricted method in java.lang.System has been called
 CAY-3001 Modeler: Auto-increment attribute is not picked up
@@ -28,6 +29,7 @@ CAY-3003 Modeler: NPE editing unmapped ObjAttribute
 CAY-3005 ResultIterator.allRows() doesn't convert to DataObjects
 CAY-3006 Can't match a "self" property of an entity with a compound PK
 CAY-3008 Disjoint prefetch returns wrong results when the query matches on a 
"self" property
+CAY-3009 Column select with CLOB attribute and distinct() fails
 
 ----------------------------------
 Release: 5.0-M3
diff --git 
a/cayenne/src/main/java/org/apache/cayenne/access/jdbc/SelectAction.java 
b/cayenne/src/main/java/org/apache/cayenne/access/jdbc/SelectAction.java
index 41f0b656b..ecbf7bf45 100644
--- a/cayenne/src/main/java/org/apache/cayenne/access/jdbc/SelectAction.java
+++ b/cayenne/src/main/java/org/apache/cayenne/access/jdbc/SelectAction.java
@@ -157,9 +157,10 @@ public class SelectAction extends BaseSQLAction {
 
         // wrap result iterator if distinct has to be suppressed
 
-        // a joint prefetch warrants full row compare
+        // a joint prefetch warrants full row compare, and so does a result 
that is not made of
+        // DataRows - a column select yields scalars or Object[], neither of 
which has an ObjectId
         final boolean[] compareFullRows = new boolean[1];
-        compareFullRows[0] = translated.hasJoins();
+        compareFullRows[0] = translated.hasJoins() || 
queryMetadata.getResultSetMapping() != null;
 
         final PrefetchTreeNode rootPrefetch = queryMetadata.getPrefetchTree();
         if (!compareFullRows[0] && rootPrefetch != null) {
diff --git 
a/cayenne/src/test/java/org/apache/cayenne/access/jdbc/SelectActionIT.java 
b/cayenne/src/test/java/org/apache/cayenne/access/jdbc/SelectActionIT.java
index 7726abd89..85cc77c6d 100644
--- a/cayenne/src/test/java/org/apache/cayenne/access/jdbc/SelectActionIT.java
+++ b/cayenne/src/test/java/org/apache/cayenne/access/jdbc/SelectActionIT.java
@@ -18,7 +18,9 @@
  ****************************************************************/
 package org.apache.cayenne.access.jdbc;
 
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import org.apache.cayenne.query.ObjectSelect;
 import org.apache.cayenne.testdo.lob.ClobTestEntity;
@@ -26,12 +28,10 @@ import org.apache.cayenne.testdo.lob.ClobTestRelation;
 import org.apache.cayenne.unit.CayenneProjects;
 import org.apache.cayenne.unit.CayenneTestsEnv;
 import org.junit.jupiter.api.extension.RegisterExtension;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 
-@Disabled("Temporary ignore this test to debug GitHub Actions failure")
 public class SelectActionIT {
 
     @RegisterExtension
@@ -67,9 +67,35 @@ public class SelectActionIT {
             // this should be 80, but we got only single values and we forcing 
distinct on them
             // so here will be only 21 elements that are unique
             assertEquals(21, result.size());
+            assertEquals(expectedClobValues(), new HashSet<>(result));
         }
     }
 
+    @Test
+    public void columnSelectWithoutJoin_DistinctResultIterator() {
+        if (env.testDbAdapter().supportsLobs()) {
+
+            insertClobDb();
+
+            List<String> result = ObjectSelect.query(ClobTestEntity.class)
+                    .column(ClobTestEntity.CLOB_COL)
+                    .distinct()
+                    .select(env.context());
+
+            assertEquals(21, result.size());
+            assertEquals(expectedClobValues(), new HashSet<>(result));
+        }
+    }
+
+    protected Set<String> expectedClobValues() {
+        Set<String> expected = new HashSet<>();
+        for (int i = 0; i < 20; i++) {
+            expected.add("a1" + i);
+        }
+        expected.add("a2");
+        return expected;
+    }
+
     protected void insertClobDb() {
         for (int i = 0; i < 80; i++) {
             ClobTestEntity obj = env.context().newObject(ClobTestEntity.class);
@@ -81,6 +107,10 @@ public class SelectActionIT {
             insertClobRel(obj);
         }
         env.context().commitChanges();
+
+        // sanity check
+        assertEquals(80L, 
ObjectSelect.query(ClobTestEntity.class).selectCount(env.context()));
+        assertEquals(1600L, 
ObjectSelect.query(ClobTestRelation.class).selectCount(env.context()));
     }
 
     protected void insertClobRel(ClobTestEntity clobId) {

Reply via email to