org.apache.ignite.cache.query.annotations

## Annotation Type QuerySqlFunction

-     @Documented
       @Retention(value=RUNTIME)
       @Target(value=METHOD)
      public @interface QuerySqlFunction

  Annotates public static methods in classes to be used in SQL queries as custom functions. Annotated class must be registered in H2 indexing SPI using following method `CacheConfiguration.setSqlFunctionClasses(Class[])`.

  Example usage:

           public class MyFunctions {
               @QuerySqlFunction
               public static int sqr(int x) {
                   return x * x;
               }
           }

           // Register.
           indexing.setSqlFunctionClasses(MyFunctions.class);

           // And use in queries.
           cache.queries().createSqlFieldsQuery("select sqr(2) where sqr(1) = 1");

  For more information about H2 custom functions please refer to H2 documentation.

- - ### Optional Element Summary

    Optional Elements
    Modifier and Type | Optional Element and Description
    --- | ---
    `String` | `alias` Specifies alias for the function to be used form SQL queries.
    `boolean` | `deterministic` Specifies if the function is deterministic (result depends only on input parameters).

- - ### Element Detail

    - #### alias

          public abstract String alias

      Specifies alias for the function to be used form SQL queries. If no alias provided method name will be used.
      Returns:
        Alias for function.
      Default:
        ""

  - - #### deterministic

          public abstract boolean deterministic

      Specifies if the function is deterministic (result depends only on input parameters).

      Deterministic function is a function which always returns the same result assuming that input parameters are the same.

      Returns:
        `true` If function is deterministic, `false` otherwise.
      Default:
        false

2020 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.9.0
Release Date | : October 15 2020