borinquenkid commented on code in PR #16818:
URL: https://github.com/apache/grails-core/pull/16818#discussion_r4436497815


##########
grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/query/FunctionCallingCriterionHandler.java:
##########
@@ -77,7 +77,12 @@ public Predicate handle(CriterionContext context, 
FunctionCallingCriterion crite
         } else if (wrapped instanceof Query.In in) {
             Collection<Object> values = new ArrayList<>();
             for (Object v : in.getValues()) {
-                
values.add(convertFunctionValue(context.getConversionService(), functionName, 
v));
+                if (v != null) {
+                    
values.add(convertFunctionValue(context.getConversionService(), functionName, 
v));

Review Comment:
   Addressed in 33ee52446f: extended `WhereQueryFunctionsSpec` with mixed-null, 
all-null, and empty `in` lists across both string-returning (`upper(name)`) and 
numeric-returning (`year(created)`, including string-to-integer conversion) 
functions.



##########
grails-data-hibernate7/core/src/test/groovy/grails/gorm/tests/hibernatequery/PredicateGeneratorSpec.groovy:
##########
@@ -632,6 +632,53 @@ class PredicateGeneratorSpec extends 
HibernateGormDatastoreSpec {
         then:
         thrown(UnsupportedOperationException)
     }
+
+    def "subquery translation does not mutate source criteria projection list 
in-place"() {
+        given:
+        def subCriteria = new 
DetachedCriteria(PredicateGeneratorSpecPerson).eq("lastName", "Smith")
+        List criteria = [
+            new Query.In("id", subCriteria),
+            new Query.EqualsAll("age", subCriteria)
+        ]
+
+        when:
+        def predicates = predicateGenerator.getPredicates(query, root, 
criteria, fromProvider, personEntity)
+
+        then:
+        predicates.length == 2
+        subCriteria.projections.isEmpty()
+    }
+
+    def "property comparison and property name criteria throw 
ConfigurationException on non-existent property"() {
+        when:
+        predicateGenerator.getPredicates(query, root, [criterion], 
fromProvider, personEntity)

Review Comment:
   Addressed in 33ee52446f: added public-API criteria query coverage 
(`c.list(...)`) in `HibernateCriteriaBuilderDirectSpec` for all four 
invalid-path cases (`eqProperty` left/right, `isNull`, and `eqAll` subquery) 
and asserted that `ConfigurationException` identifies the offending property 
name.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to