Package org.apache.ignite.cache.query.annotations

## Annotation Type QuerySqlFunction

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

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

  Example usage:

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

           // Register in CacheConfiguration.
           cacheCfg.setSqlFunctionClasses(MyFunctions.class);

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

  SQL functions can use attributes set on client side:

           public class MyFunctions {
               @SessionContextProviderResource
               public SessionContextProvider sesCtxProv;

               @QuerySqlFunction
               public String sessionId() {
                   return sesCtxProv.getSessionContext().getAttribute("SESSION_ID");
               }
           }

  Note, accessing to the attributes is available in the Calcite query engine only. In a such case a class must have public zero-args constructor.
  See Also:
    `QuerySqlTableFunction`, `SessionContextProviderResource`

- - ### Optional Element Summary

    Optional Elements
    Modifier and Type | Optional Element | 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

          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

          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