diff --git a/documentation/src/main/asciidoc/userguide/chapters/query/hql/QueryLanguage.adoc b/documentation/src/main/asciidoc/userguide/chapters/query/hql/QueryLanguage.adoc index 90013b73b3..aeb792d83d 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/query/hql/QueryLanguage.adoc +++ b/documentation/src/main/asciidoc/userguide/chapters/query/hql/QueryLanguage.adoc @@ -1130,6 +1130,7 @@ The following functions deal with SQL array types, which are not supported on ev | `array_get()` | Accesses the element of an array by index | `array_set()` | Creates array copy with given element at given index | `array_remove()` | Creates array copy with given element removed +| `array_remove_index()` | Creates array copy with the element at the given index removed | `array_slice()` | Creates a sub-array of the based on lower and upper index | `array_replace()` | Creates array copy replacing a given element with another |=== diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/NodeBuilder.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/NodeBuilder.java index bc84f39c9f..718018a163 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/NodeBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/NodeBuilder.java @@ -97,6 +97,554 @@ SqmTuple tuple( SqmExpressible tupleType, List> expressions); + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // Array functions for array types + + /** + * Creates an array literal with the {@code array} constructor function. + * + * @since 6.4 + */ + SqmExpression arrayLiteral(T... elements); + + /** + * Determines the 1-based position of an element in an array. + * + * @since 6.4 + */ + SqmExpression arrayPosition(SqmExpression arrayExpression, T element); + + /** + * Determines the 1-based position of an element in an array. + * + * @since 6.4 + */ + SqmExpression arrayPosition(SqmExpression arrayExpression, SqmExpression elementExpression); + + /** + * Determines the length of an array. + * + * @since 6.4 + */ + SqmExpression arrayLength(SqmExpression arrayExpression); + + /** + * Concatenates arrays with each other in order. + * + * @since 6.4 + */ + SqmExpression arrayConcat(SqmExpression arrayExpression1, SqmExpression arrayExpression2); + + /** + * Concatenates arrays with each other in order. + * + * @since 6.4 + */ + SqmExpression arrayConcat(SqmExpression arrayExpression1, T[] array2); + + /** + * Concatenates arrays with each other in order. + * + * @since 6.4 + */ + SqmExpression arrayConcat(T[] array1, SqmExpression arrayExpression2); + + /** + * Concatenates arrays with each other in order. + * + * @since 6.4 + */ + SqmExpression arrayConcat(T[] array1, T[] array2); + + /** + * Appends element to array. + * + * @since 6.4 + */ + SqmExpression arrayAppend(SqmExpression arrayExpression, SqmExpression elementExpression); + + /** + * Appends element to array. + * + * @since 6.4 + */ + SqmExpression arrayAppend(SqmExpression arrayExpression, T element); + + /** + * Appends element to array. + * + * @since 6.4 + */ + SqmExpression arrayAppend(T[] array, SqmExpression elementExpression); + + /** + * Appends element to array. + * + * @since 6.4 + */ + SqmExpression arrayAppend(T[] array, T element); + + /** + * Prepends element to array. + * + * @since 6.4 + */ + SqmExpression arrayPrepend(SqmExpression elementExpression, SqmExpression arrayExpression); + + /** + * Prepends element to array. + * + * @since 6.4 + */ + SqmExpression arrayPrepend(T element, SqmExpression arrayExpression); + + /** + * Prepends element to array. + * + * @since 6.4 + */ + SqmExpression arrayPrepend(SqmExpression elementExpression, T[] array); + + /** + * Prepends element to array. + * + * @since 6.4 + */ + SqmExpression arrayPrepend(T element, T[] array); + + /** + * Whether an array contains an element. + * + * @since 6.4 + */ + SqmPredicate arrayContains(SqmExpression arrayExpression, SqmExpression elementExpression); + + /** + * Whether an array contains an element. + * + * @since 6.4 + */ + SqmPredicate arrayContains(SqmExpression arrayExpression, T element); + + /** + * Whether an array contains an element. + * + * @since 6.4 + */ + SqmPredicate arrayContains(T[] array, SqmExpression elementExpression); + + /** + * Whether an array contains an element. + * + * @since 6.4 + */ + SqmPredicate arrayContains(T[] array, T element); + + /** + * Whether an array contains a nullable element. + * + * @since 6.4 + */ + SqmPredicate arrayContainsNullable(SqmExpression arrayExpression, SqmExpression elementExpression); + + /** + * Whether an array contains a nullable element. + * + * @since 6.4 + */ + SqmPredicate arrayContainsNullable(SqmExpression arrayExpression, T element); + + /** + * Whether an array contains a nullable element. + * + * @since 6.4 + */ + SqmPredicate arrayContainsNullable(T[] array, SqmExpression elementExpression); + + /** + * Whether an array contains a nullable element. + * + * @since 6.4 + */ + SqmPredicate arrayContainsNullable(T[] array, T element); + + /** + * Whether an array contains another array. + * + * @since 6.4 + */ + SqmPredicate arrayContainsAll(SqmExpression arrayExpression, SqmExpression subArrayExpression); + + /** + * Whether an array contains another array. + * + * @since 6.4 + */ + SqmPredicate arrayContainsAll(SqmExpression arrayExpression, T[] subArray); + + /** + * Whether an array contains another array. + * + * @since 6.4 + */ + SqmPredicate arrayContainsAll(T[] array, SqmExpression subArrayExpression); + + /** + * Whether an array contains another array. + * + * @since 6.4 + */ + SqmPredicate arrayContainsAll(T[] array, T[] subArray); + + /** + * Whether an array contains another array with nullable elements. + * + * @since 6.4 + */ + SqmPredicate arrayContainsAllNullable(SqmExpression arrayExpression, SqmExpression subArrayExpression); + + /** + * Whether an array contains another array with nullable elements. + * + * @since 6.4 + */ + SqmPredicate arrayContainsAllNullable(SqmExpression arrayExpression, T[] subArray); + + /** + * Whether an array contains another array with nullable elements. + * + * @since 6.4 + */ + SqmPredicate arrayContainsAllNullable(T[] array, SqmExpression subArrayExpression); + + /** + * Whether an array contains another array with nullable elements. + * + * @since 6.4 + */ + SqmPredicate arrayContainsAllNullable(T[] array, T[] subArray); + + /** + * Whether one array has any elements common with another array. + * + * @since 6.4 + */ + SqmPredicate arrayOverlaps(SqmExpression arrayExpression1, SqmExpression arrayExpression2); + + /** + * Whether one array has any elements common with another array. + * + * @since 6.4 + */ + SqmPredicate arrayOverlaps(SqmExpression arrayExpression1, T[] array2); + + /** + * Whether one array has any elements common with another array. + * + * @since 6.4 + */ + SqmPredicate arrayOverlaps(T[] array1, SqmExpression arrayExpression2); + + /** + * Whether one array has any elements common with another array. + * + * @since 6.4 + */ + SqmPredicate arrayOverlaps(T[] array1, T[] array2); + + /** + * Whether one array has any elements common with another array, supporting {@code null} elements. + * + * @since 6.4 + */ + SqmPredicate arrayOverlapsNullable(SqmExpression arrayExpression1, SqmExpression arrayExpression2); + + /** + * Whether one array has any elements common with another array, supporting {@code null} elements. + * + * @since 6.4 + */ + SqmPredicate arrayOverlapsNullable(SqmExpression arrayExpression1, T[] array2); + + /** + * Whether one array has any elements common with another array, supporting {@code null} elements. + * + * @since 6.4 + */ + SqmPredicate arrayOverlapsNullable(T[] array1, SqmExpression arrayExpression2); + + /** + * Whether one array has any elements common with another array, supporting {@code null} elements. + * + * @since 6.4 + */ + SqmPredicate arrayOverlapsNullable(T[] array1, T[] array2); + + /** + * Accesses the element of an array by 1-based index. + * + * @since 6.4 + */ + SqmExpression arrayGet(SqmExpression arrayExpression, SqmExpression indexExpression); + + /** + * Accesses the element of an array by 1-based index. + * + * @since 6.4 + */ + SqmExpression arrayGet(SqmExpression arrayExpression, Integer index); + + /** + * Accesses the element of an array by 1-based index. + * + * @since 6.4 + */ + SqmExpression arrayGet(T[] array, SqmExpression indexExpression); + + /** + * Accesses the element of an array by 1-based index. + * + * @since 6.4 + */ + SqmExpression arrayGet(T[] array, Integer index); + + /** + * Creates array copy with given element at given 1-based index. + * + * @since 6.4 + */ + SqmExpression arraySet(SqmExpression arrayExpression, SqmExpression indexExpression, SqmExpression elementExpression); + /** + * Creates array copy with given element at given 1-based index. + * + * @since 6.4 + */ + SqmExpression arraySet(SqmExpression arrayExpression, SqmExpression indexExpression, T element); + + /** + * Creates array copy with given element at given 1-based index. + * + * @since 6.4 + */ + SqmExpression arraySet(SqmExpression arrayExpression, Integer index, SqmExpression elementExpression); + + /** + * Creates array copy with given element at given 1-based index. + * + * @since 6.4 + */ + SqmExpression arraySet(SqmExpression arrayExpression, Integer index, T element); + + /** + * Creates array copy with given element at given 1-based index. + * + * @since 6.4 + */ + SqmExpression arraySet(T[] array, SqmExpression indexExpression, SqmExpression elementExpression); + + /** + * Creates array copy with given element at given 1-based index. + * + * @since 6.4 + */ + SqmExpression arraySet(T[] array, SqmExpression indexExpression, T element); + + /** + * Creates array copy with given element at given 1-based index. + * + * @since 6.4 + */ + SqmExpression arraySet(T[] array, Integer index, SqmExpression elementExpression); + + /** + * Creates array copy with given element at given 1-based index. + * + * @since 6.4 + */ + SqmExpression arraySet(T[] array, Integer index, T element); + + /** + * Creates array copy with given element removed. + * + * @since 6.4 + */ + SqmExpression arrayRemove(SqmExpression arrayExpression, SqmExpression elementExpression); + + /** + * Creates array copy with given element removed. + * + * @since 6.4 + */ + SqmExpression arrayRemove(SqmExpression arrayExpression, T element); + + /** + * Creates array copy with given element removed. + * + * @since 6.4 + */ + SqmExpression arrayRemove(T[] array, SqmExpression elementExpression); + + /** + * Creates array copy with given element removed. + * + * @since 6.4 + */ + SqmExpression arrayRemove(T[] array, T element); + + /** + * Creates array copy with the element at the given 1-based index removed. + * + * @since 6.4 + */ + SqmExpression arrayRemoveIndex(SqmExpression arrayExpression, SqmExpression indexExpression); + + /** + * Creates array copy with the element at the given 1-based index removed. + * + * @since 6.4 + */ + SqmExpression arrayRemoveIndex(SqmExpression arrayExpression, Integer index); + + /** + * Creates array copy with the element at the given 1-based index removed. + * + * @since 6.4 + */ + SqmExpression arrayRemoveIndex(T[] array, SqmExpression indexExpression); + + /** + * Creates array copy with the element at the given 1-based index removed. + * + * @since 6.4 + */ + SqmExpression arrayRemoveIndex(T[] array, Integer index); + + /** + * Creates a sub-array of the based on 1-based lower and upper index. + * Both indexes are inclusive. + * + * @since 6.4 + */ + SqmExpression arraySlice(SqmExpression arrayExpression, SqmExpression lowerIndexExpression, SqmExpression upperIndexExpression); + + /** + * Creates a sub-array of the based on 1-based lower and upper index. + * Both indexes are inclusive. + * + * @since 6.4 + */ + SqmExpression arraySlice(SqmExpression arrayExpression, SqmExpression lowerIndexExpression, Integer upperIndex); + /** + * Creates a sub-array of the based on 1-based lower and upper index. + * Both indexes are inclusive. + * + * @since 6.4 + */ + SqmExpression arraySlice(SqmExpression arrayExpression, Integer lowerIndex, SqmExpression upperIndexExpression); + + /** + * Creates a sub-array of the based on 1-based lower and upper index. + * Both indexes are inclusive. + * + * @since 6.4 + */ + SqmExpression arraySlice(SqmExpression arrayExpression, Integer lowerIndex, Integer upperIndex); + + /** + * Creates a sub-array of the based on 1-based lower and upper index. + * Both indexes are inclusive. + * + * @since 6.4 + */ + SqmExpression arraySlice(T[] array, SqmExpression lowerIndexExpression, SqmExpression upperIndexExpression); + + /** + * Creates a sub-array of the based on 1-based lower and upper index. + * Both indexes are inclusive. + * + * @since 6.4 + */ + SqmExpression arraySlice(T[] array, SqmExpression lowerIndexExpression, Integer upperIndex); + + /** + * Creates a sub-array of the based on 1-based lower and upper index. + * Both indexes are inclusive. + * + * @since 6.4 + */ + SqmExpression arraySlice(T[] array, Integer lowerIndex, SqmExpression upperIndexExpression); + + /** + * Creates a sub-array of the based on 1-based lower and upper index. + * Both indexes are inclusive. + * + * @since 6.4 + */ + SqmExpression arraySlice(T[] array, Integer lowerIndex, Integer upperIndex); + + /** + * Creates array copy replacing a given element with another. + * + * @since 6.4 + */ + SqmExpression arrayReplace(SqmExpression arrayExpression, SqmExpression oldElementExpression, SqmExpression newElementExpression); + + /** + * Creates array copy replacing a given element with another. + * + * @since 6.4 + */ + SqmExpression arrayReplace(SqmExpression arrayExpression, SqmExpression oldElementExpression, T newElement); + + /** + * Creates array copy replacing a given element with another. + * + * @since 6.4 + */ + SqmExpression arrayReplace(SqmExpression arrayExpression, T oldElement, SqmExpression newElementExpression); + + /** + * Creates array copy replacing a given element with another. + * + * @since 6.4 + */ + SqmExpression arrayReplace(SqmExpression arrayExpression, T oldElement, T newElement); + + /** + * Creates array copy replacing a given element with another. + * + * @since 6.4 + */ + SqmExpression arrayReplace(T[] array, SqmExpression oldElementExpression, SqmExpression newElementExpression); + + /** + * Creates array copy replacing a given element with another. + * + * @since 6.4 + */ + SqmExpression arrayReplace(T[] array, SqmExpression oldElementExpression, T newElement); + + /** + * Creates array copy replacing a given element with another. + * + * @since 6.4 + */ + SqmExpression arrayReplace(T[] array, T oldElement, SqmExpression newElementExpression); + + /** + * Creates array copy replacing a given element with another. + * + * @since 6.4 + */ + SqmExpression arrayReplace(T[] array, T oldElement, T newElement); + + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // Array functions for collection types + + + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // Covariant overrides + @Override SqmSelectStatement createQuery(); diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmCriteriaNodeBuilder.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmCriteriaNodeBuilder.java index 947137a5db..e5796deec8 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmCriteriaNodeBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmCriteriaNodeBuilder.java @@ -3631,4 +3631,747 @@ public SqmExpression percentRank( Expression... arguments) { return functionWithinGroup( "percent_rank", Double.class, order, filter, window, arguments ); } + + @Override + public SqmExpression arrayLiteral(T... elements) { + return getFunctionDescriptor( "array" ).generateSqmExpression( + literals( elements ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayPosition(SqmExpression arrayExpression, T element) { + return getFunctionDescriptor( "array_position" ).generateSqmExpression( + asList( arrayExpression, value( element ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayPosition( + SqmExpression arrayExpression, + SqmExpression elementExpression) { + return getFunctionDescriptor( "array_position" ).generateSqmExpression( + asList( arrayExpression, elementExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayLength(SqmExpression arrayExpression) { + return getFunctionDescriptor( "array_length" ).generateSqmExpression( + asList( arrayExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayConcat( + SqmExpression arrayExpression1, + SqmExpression arrayExpression2) { + return getFunctionDescriptor( "array_concat" ).generateSqmExpression( + asList( arrayExpression1, arrayExpression2 ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayConcat(SqmExpression arrayExpression1, T[] array2) { + return getFunctionDescriptor( "array_concat" ).generateSqmExpression( + asList( arrayExpression1, value( array2, arrayExpression1 ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayConcat(T[] array1, SqmExpression arrayExpression2) { + return getFunctionDescriptor( "array_concat" ).generateSqmExpression( + asList( value( array1, arrayExpression2 ), arrayExpression2 ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayConcat(T[] array1, T[] array2) { + return getFunctionDescriptor( "array_concat" ).generateSqmExpression( + asList( value( array1 ), value( array2 ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayAppend(SqmExpression arrayExpression, SqmExpression elementExpression) { + return getFunctionDescriptor( "array_append" ).generateSqmExpression( + asList( arrayExpression, elementExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayAppend(SqmExpression arrayExpression, T element) { + return getFunctionDescriptor( "array_append" ).generateSqmExpression( + asList( arrayExpression, value( element ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayAppend(T[] array, SqmExpression elementExpression) { + return getFunctionDescriptor( "array_append" ).generateSqmExpression( + asList( value( array ), elementExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayAppend(T[] array, T element) { + return getFunctionDescriptor( "array_append" ).generateSqmExpression( + asList( value( array ), value( element ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayPrepend(SqmExpression elementExpression, SqmExpression arrayExpression) { + return getFunctionDescriptor( "array_prepend" ).generateSqmExpression( + asList( elementExpression, arrayExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayPrepend(T element, SqmExpression arrayExpression) { + return getFunctionDescriptor( "array_prepend" ).generateSqmExpression( + asList( value( element ), arrayExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayPrepend(SqmExpression elementExpression, T[] array) { + return getFunctionDescriptor( "array_prepend" ).generateSqmExpression( + asList( elementExpression, value( array ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayPrepend(T element, T[] array) { + return getFunctionDescriptor( "array_prepend" ).generateSqmExpression( + asList( value( element ), value( array ) ), + null, + queryEngine + ); + } + + @Override + public SqmPredicate arrayContains(SqmExpression arrayExpression, SqmExpression elementExpression) { + return isTrue( getFunctionDescriptor( "array_contains" ).generateSqmExpression( + asList( arrayExpression, elementExpression ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayContains(SqmExpression arrayExpression, T element) { + return isTrue( getFunctionDescriptor( "array_contains" ).generateSqmExpression( + asList( arrayExpression, value( element ) ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayContains(T[] array, SqmExpression elementExpression) { + return isTrue( getFunctionDescriptor( "array_contains" ).generateSqmExpression( + asList( value( array ), elementExpression ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayContains(T[] array, T element) { + return isTrue( getFunctionDescriptor( "array_contains" ).generateSqmExpression( + asList( value( array ), value( element ) ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayContainsNullable( + SqmExpression arrayExpression, + SqmExpression elementExpression) { + return isTrue( getFunctionDescriptor( "array_contains_nullable" ).generateSqmExpression( + asList( arrayExpression, elementExpression ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayContainsNullable(SqmExpression arrayExpression, T element) { + return isTrue( getFunctionDescriptor( "array_contains_nullable" ).generateSqmExpression( + asList( arrayExpression, value( element ) ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayContainsNullable(T[] array, SqmExpression elementExpression) { + return isTrue( getFunctionDescriptor( "array_contains_nullable" ).generateSqmExpression( + asList( value( array ), elementExpression ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayContainsNullable(T[] array, T element) { + return isTrue( getFunctionDescriptor( "array_contains_nullable" ).generateSqmExpression( + asList( value( array ), value( element ) ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayContainsAll( + SqmExpression arrayExpression, + SqmExpression subArrayExpression) { + return isTrue( getFunctionDescriptor( "array_contains" ).generateSqmExpression( + asList( arrayExpression, subArrayExpression ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayContainsAll(SqmExpression arrayExpression, T[] subArray) { + return isTrue( getFunctionDescriptor( "array_contains" ).generateSqmExpression( + asList( arrayExpression, value( subArray, arrayExpression ) ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayContainsAll(T[] array, SqmExpression subArrayExpression) { + return isTrue( getFunctionDescriptor( "array_contains" ).generateSqmExpression( + asList( value( array, subArrayExpression ), subArrayExpression ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayContainsAll(T[] array, T[] subArray) { + return isTrue( getFunctionDescriptor( "array_contains" ).generateSqmExpression( + asList( value( array ), value( subArray ) ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayContainsAllNullable( + SqmExpression arrayExpression, + SqmExpression subArrayExpression) { + return isTrue( getFunctionDescriptor( "array_contains_nullable" ).generateSqmExpression( + asList( arrayExpression, subArrayExpression ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayContainsAllNullable(SqmExpression arrayExpression, T[] subArray) { + return isTrue( getFunctionDescriptor( "array_contains_nullable" ).generateSqmExpression( + asList( arrayExpression, value( subArray, arrayExpression ) ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayContainsAllNullable(T[] array, SqmExpression subArrayExpression) { + return isTrue( getFunctionDescriptor( "array_contains_nullable" ).generateSqmExpression( + asList( value( array, subArrayExpression ), subArrayExpression ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayContainsAllNullable(T[] array, T[] subArray) { + return isTrue( getFunctionDescriptor( "array_contains_nullable" ).generateSqmExpression( + asList( value( array ), value( subArray ) ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayOverlaps(SqmExpression arrayExpression1, SqmExpression arrayExpression2) { + return isTrue( getFunctionDescriptor( "array_overlaps" ).generateSqmExpression( + asList( arrayExpression1, arrayExpression2 ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayOverlaps(SqmExpression arrayExpression1, T[] array2) { + return isTrue( getFunctionDescriptor( "array_overlaps" ).generateSqmExpression( + asList( arrayExpression1, value( array2, arrayExpression1 ) ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayOverlaps(T[] array1, SqmExpression arrayExpression2) { + return isTrue( getFunctionDescriptor( "array_overlaps" ).generateSqmExpression( + asList( value( array1, arrayExpression2 ), arrayExpression2 ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayOverlaps(T[] array1, T[] array2) { + return isTrue( getFunctionDescriptor( "array_overlaps" ).generateSqmExpression( + asList( value( array1 ), value( array2 ) ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayOverlapsNullable( + SqmExpression arrayExpression1, + SqmExpression arrayExpression2) { + return isTrue( getFunctionDescriptor( "array_overlaps_nullable" ).generateSqmExpression( + asList( arrayExpression1, arrayExpression2 ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayOverlapsNullable(SqmExpression arrayExpression1, T[] array2) { + return isTrue( getFunctionDescriptor( "array_overlaps_nullable" ).generateSqmExpression( + asList( arrayExpression1, value( array2, arrayExpression1 ) ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayOverlapsNullable(T[] array1, SqmExpression arrayExpression2) { + return isTrue( getFunctionDescriptor( "array_overlaps_nullable" ).generateSqmExpression( + asList( value( array1, arrayExpression2 ), arrayExpression2 ), + null, + queryEngine + ) ); + } + + @Override + public SqmPredicate arrayOverlapsNullable(T[] array1, T[] array2) { + return isTrue( getFunctionDescriptor( "array_overlaps_nullable" ).generateSqmExpression( + asList( value( array1 ), value( array2 ) ), + null, + queryEngine + ) ); + } + + @Override + public SqmExpression arrayGet(SqmExpression arrayExpression, SqmExpression indexExpression) { + return getFunctionDescriptor( "array_get" ).generateSqmExpression( + asList( arrayExpression, indexExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayGet(SqmExpression arrayExpression, Integer index) { + return getFunctionDescriptor( "array_get" ).generateSqmExpression( + asList( arrayExpression, value( index ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayGet(T[] array, SqmExpression indexExpression) { + return getFunctionDescriptor( "array_get" ).generateSqmExpression( + asList( value( array ), indexExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayGet(T[] array, Integer index) { + return getFunctionDescriptor( "array_get" ).generateSqmExpression( + asList( value( array ), value( index ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arraySet( + SqmExpression arrayExpression, + SqmExpression indexExpression, + SqmExpression elementExpression) { + return getFunctionDescriptor( "array_set" ).generateSqmExpression( + asList( arrayExpression, indexExpression, elementExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arraySet( + SqmExpression arrayExpression, + SqmExpression indexExpression, + T element) { + return getFunctionDescriptor( "array_set" ).generateSqmExpression( + asList( arrayExpression, indexExpression, value( element ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arraySet( + SqmExpression arrayExpression, + Integer index, + SqmExpression elementExpression) { + return getFunctionDescriptor( "array_set" ).generateSqmExpression( + asList( arrayExpression, value( index ), elementExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arraySet(SqmExpression arrayExpression, Integer index, T element) { + return getFunctionDescriptor( "array_set" ).generateSqmExpression( + asList( arrayExpression, value( index ), value( element ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arraySet( + T[] array, + SqmExpression indexExpression, + SqmExpression elementExpression) { + return getFunctionDescriptor( "array_set" ).generateSqmExpression( + asList( value( array ), indexExpression, elementExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arraySet(T[] array, SqmExpression indexExpression, T element) { + return getFunctionDescriptor( "array_set" ).generateSqmExpression( + asList( value( array ), indexExpression, value( element ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arraySet(T[] array, Integer index, SqmExpression elementExpression) { + return getFunctionDescriptor( "array_set" ).generateSqmExpression( + asList( value( array ), value( index ), elementExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arraySet(T[] array, Integer index, T element) { + return getFunctionDescriptor( "array_set" ).generateSqmExpression( + asList( value( array ), value( index ), value( element ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayRemove(SqmExpression arrayExpression, SqmExpression elementExpression) { + return getFunctionDescriptor( "array_remove" ).generateSqmExpression( + asList( arrayExpression, elementExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayRemove(SqmExpression arrayExpression, T element) { + return getFunctionDescriptor( "array_remove" ).generateSqmExpression( + asList( arrayExpression, value( element ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayRemove(T[] array, SqmExpression elementExpression) { + return getFunctionDescriptor( "array_remove" ).generateSqmExpression( + asList( value( array ), elementExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayRemove(T[] array, T element) { + return getFunctionDescriptor( "array_remove" ).generateSqmExpression( + asList( value( array ), value( element ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayRemoveIndex( + SqmExpression arrayExpression, + SqmExpression indexExpression) { + return getFunctionDescriptor( "array_remove_index" ).generateSqmExpression( + asList( arrayExpression, indexExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayRemoveIndex(SqmExpression arrayExpression, Integer index) { + return getFunctionDescriptor( "array_remove_index" ).generateSqmExpression( + asList( arrayExpression, value( index ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayRemoveIndex(T[] array, SqmExpression indexExpression) { + return getFunctionDescriptor( "array_remove_index" ).generateSqmExpression( + asList( value( array ), indexExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayRemoveIndex(T[] array, Integer index) { + return getFunctionDescriptor( "array_remove_index" ).generateSqmExpression( + asList( value( array ), value( index ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arraySlice( + SqmExpression arrayExpression, + SqmExpression lowerIndexExpression, + SqmExpression upperIndexExpression) { + return getFunctionDescriptor( "array_slice" ).generateSqmExpression( + asList( arrayExpression, lowerIndexExpression, upperIndexExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arraySlice( + SqmExpression arrayExpression, + SqmExpression lowerIndexExpression, + Integer upperIndex) { + return getFunctionDescriptor( "array_slice" ).generateSqmExpression( + asList( arrayExpression, lowerIndexExpression, value( upperIndex ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arraySlice( + SqmExpression arrayExpression, + Integer lowerIndex, + SqmExpression upperIndexExpression) { + return getFunctionDescriptor( "array_slice" ).generateSqmExpression( + asList( arrayExpression, value( lowerIndex ), upperIndexExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arraySlice( + SqmExpression arrayExpression, + Integer lowerIndex, + Integer upperIndex) { + return getFunctionDescriptor( "array_slice" ).generateSqmExpression( + asList( arrayExpression, value( lowerIndex ), value( upperIndex ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arraySlice( + T[] array, + SqmExpression lowerIndexExpression, + SqmExpression upperIndexExpression) { + return getFunctionDescriptor( "array_slice" ).generateSqmExpression( + asList( value( array ), lowerIndexExpression, upperIndexExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arraySlice( + T[] array, + SqmExpression lowerIndexExpression, + Integer upperIndex) { + return getFunctionDescriptor( "array_slice" ).generateSqmExpression( + asList( value( array ), lowerIndexExpression, value( upperIndex ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arraySlice( + T[] array, + Integer lowerIndex, + SqmExpression upperIndexExpression) { + return getFunctionDescriptor( "array_slice" ).generateSqmExpression( + asList( value( array ), value( lowerIndex ), upperIndexExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arraySlice(T[] array, Integer lowerIndex, Integer upperIndex) { + return getFunctionDescriptor( "array_slice" ).generateSqmExpression( + asList( value( array ), value( lowerIndex ), value( upperIndex ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayReplace( + SqmExpression arrayExpression, + SqmExpression oldElementExpression, + SqmExpression newElementExpression) { + return getFunctionDescriptor( "array_replace" ).generateSqmExpression( + asList( arrayExpression, oldElementExpression, newElementExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayReplace( + SqmExpression arrayExpression, + SqmExpression oldElementExpression, + T newElement) { + return getFunctionDescriptor( "array_replace" ).generateSqmExpression( + asList( arrayExpression, oldElementExpression, value( newElement ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayReplace( + SqmExpression arrayExpression, + T oldElement, + SqmExpression newElementExpression) { + return getFunctionDescriptor( "array_replace" ).generateSqmExpression( + asList( arrayExpression, value( oldElement ), newElementExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayReplace(SqmExpression arrayExpression, T oldElement, T newElement) { + return getFunctionDescriptor( "array_replace" ).generateSqmExpression( + asList( arrayExpression, value( oldElement ), value( newElement ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayReplace( + T[] array, + SqmExpression oldElementExpression, + SqmExpression newElementExpression) { + return getFunctionDescriptor( "array_replace" ).generateSqmExpression( + asList( value( array ), oldElementExpression, newElementExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayReplace(T[] array, SqmExpression oldElementExpression, T newElement) { + return getFunctionDescriptor( "array_replace" ).generateSqmExpression( + asList( value( array ), oldElementExpression, value( newElement ) ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayReplace(T[] array, T oldElement, SqmExpression newElementExpression) { + return getFunctionDescriptor( "array_replace" ).generateSqmExpression( + asList( value( array ), value( oldElement ), newElementExpression ), + null, + queryEngine + ); + } + + @Override + public SqmExpression arrayReplace(T[] array, T oldElement, T newElement) { + return getFunctionDescriptor( "array_replace" ).generateSqmExpression( + asList( value( array ), value( oldElement ), value( newElement ) ), + null, + queryEngine + ); + } }