Class H2UnnestFunction
java.lang.Object
org.hibernate.query.sqm.function.AbstractSqmSetReturningFunctionDescriptor
org.hibernate.query.sqm.function.AbstractSqmSelfRenderingSetReturningFunctionDescriptor
org.hibernate.dialect.function.array.UnnestFunction
org.hibernate.dialect.function.array.H2UnnestFunction
- All Implemented Interfaces:
SetReturningFunctionRenderer,SqmSetReturningFunctionDescriptor
H2 unnest function.
H2 does not support "lateral" i.e. the use of a from node within another, but we can apply the same trick that we already applied everywhere else for H2, which is to join a sequence table to emulate array element rows and eliminate non-existing array elements by checking the index against array length. Finally, we rewrite the selection expressions to access the array by joined sequence index.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> SelfRenderingSqmSetReturningFunction<T> generateSqmSetReturningFunctionExpression(List<? extends SqmTypedNode<?>> arguments, QueryEngine queryEngine) Return an SQM node or subtree representing an invocation of this function with the given arguments.protected voidrenderJsonTable(SqlAppender sqlAppender, Expression array, BasicPluralType<?, ?> pluralType, @Nullable SqlTypedMapping sqlTypedMapping, AnonymousTupleTableGroupProducer tupleType, String tableIdentifierVariable, SqlAstTranslator<?> walker) protected voidrenderUnnest(SqlAppender sqlAppender, Expression array, BasicPluralType<?, ?> pluralType, @Nullable SqlTypedMapping sqlTypedMapping, AnonymousTupleTableGroupProducer tupleType, String tableIdentifierVariable, SqlAstTranslator<?> walker) Methods inherited from class org.hibernate.dialect.function.array.UnnestFunction
getDdlType, render, renderJsonTableColumns, renderXmlTable, renderXmlTableColumnsMethods inherited from class org.hibernate.query.sqm.function.AbstractSqmSetReturningFunctionDescriptor
generateSqmExpression, getArgumentListSignature, getArgumentsValidator, getArgumentTypeResolver, getName, getSetReturningTypeResolver, getSignatureMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.query.sqm.function.SetReturningFunctionRenderer
rendersIdentifierVariable
-
Constructor Details
-
H2UnnestFunction
public H2UnnestFunction(int maximumArraySize)
-
-
Method Details
-
generateSqmSetReturningFunctionExpression
protected <T> SelfRenderingSqmSetReturningFunction<T> generateSqmSetReturningFunctionExpression(List<? extends SqmTypedNode<?>> arguments, QueryEngine queryEngine) Description copied from class:AbstractSqmSetReturningFunctionDescriptorReturn an SQM node or subtree representing an invocation of this function with the given arguments. This method may be overridden in the case of function descriptors that wish to customize creation of the node.- Overrides:
generateSqmSetReturningFunctionExpressionin classAbstractSqmSelfRenderingSetReturningFunctionDescriptor- Parameters:
arguments- the arguments of the function invocation
-
renderJsonTable
protected void renderJsonTable(SqlAppender sqlAppender, Expression array, BasicPluralType<?, ?> pluralType, @Nullable SqlTypedMapping sqlTypedMapping, AnonymousTupleTableGroupProducer tupleType, String tableIdentifierVariable, SqlAstTranslator<?> walker) - Overrides:
renderJsonTablein classUnnestFunction
-
renderUnnest
protected void renderUnnest(SqlAppender sqlAppender, Expression array, BasicPluralType<?, ?> pluralType, @Nullable SqlTypedMapping sqlTypedMapping, AnonymousTupleTableGroupProducer tupleType, String tableIdentifierVariable, SqlAstTranslator<?> walker) - Overrides:
renderUnnestin classUnnestFunction
-