Class GaussDBTruncRoundFunction

java.lang.Object
org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor
org.hibernate.community.dialect.function.GaussDBTruncRoundFunction
All Implemented Interfaces:
org.hibernate.query.sqm.function.FunctionRenderer, org.hibernate.query.sqm.function.SqmFunctionDescriptor

public class GaussDBTruncRoundFunction extends org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor implements org.hibernate.query.sqm.function.FunctionRenderer
GaussDB only supports the two-argument trunc and round functions with the following signatures:
  • trunc(numeric, integer)
  • round(numeric, integer)

This custom function falls back to using floor as a workaround only when necessary, e.g. when there are 2 arguments to the function and either:

  • The first argument is not of type numeric, or
  • The dialect doesn't support the two-argument trunc function
  • Constructor Summary

    Constructors
    Constructor
    Description
    GaussDBTruncRoundFunction(String name, boolean supportsTwoArguments)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected <T> org.hibernate.query.sqm.function.SelfRenderingSqmFunction<T>
    generateSqmFunctionExpression(List<? extends org.hibernate.query.sqm.tree.SqmTypedNode<?>> arguments, org.hibernate.metamodel.model.domain.ReturnableType<T> impliedResultType, org.hibernate.query.spi.QueryEngine queryEngine)
     
    void
    render(org.hibernate.sql.ast.spi.SqlAppender sqlAppender, List<? extends org.hibernate.sql.ast.tree.SqlAstNode> arguments, org.hibernate.metamodel.model.domain.ReturnableType<?> returnType, org.hibernate.sql.ast.SqlAstTranslator<?> walker)
     

    Methods declared in class org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor

    generateAggregateSqmExpression, generateOrderedSetAggregateSqmExpression, generateSqmAggregateFunctionExpression, generateSqmExpression, generateSqmOrderedSetAggregateFunctionExpression, generateSqmWindowFunctionExpression, generateWindowSqmExpression, getArgumentListSignature, getArgumentsValidator, getArgumentTypeResolver, getName, getReturnSignature, getReturnTypeResolver, getSignature

    Methods declared in interface org.hibernate.query.sqm.function.FunctionRenderer

    render, render, render, render

    Methods declared in interface org.hibernate.query.sqm.function.SqmFunctionDescriptor

    alwaysIncludesParentheses, generateSqmExpression, generateSqmExpression, getFunctionKind, isPredicate
  • Constructor Details

    • GaussDBTruncRoundFunction

      public GaussDBTruncRoundFunction(String name, boolean supportsTwoArguments)
  • Method Details

    • render

      public void render(org.hibernate.sql.ast.spi.SqlAppender sqlAppender, List<? extends org.hibernate.sql.ast.tree.SqlAstNode> arguments, org.hibernate.metamodel.model.domain.ReturnableType<?> returnType, org.hibernate.sql.ast.SqlAstTranslator<?> walker)
      Specified by:
      render in interface org.hibernate.query.sqm.function.FunctionRenderer
    • generateSqmFunctionExpression

      protected <T> org.hibernate.query.sqm.function.SelfRenderingSqmFunction<T> generateSqmFunctionExpression(List<? extends org.hibernate.query.sqm.tree.SqmTypedNode<?>> arguments, org.hibernate.metamodel.model.domain.ReturnableType<T> impliedResultType, org.hibernate.query.spi.QueryEngine queryEngine)
      Specified by:
      generateSqmFunctionExpression in class org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor